diff --git a/gulpfile.js b/gulpfile.js index 2225b11dab..906d31e35e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -106,11 +106,7 @@ gulp.task('closure', ['clean'], () => { full(); const project = new PolymerProject({ - shell: `./${entry}`, - fragments: [ - 'bower_components/shadycss/apply-shim.html', - 'bower_components/shadycss/custom-style-interface.html' - ] + shell: `./${entry}` }); const closureStream = closure({ @@ -123,7 +119,7 @@ gulp.task('closure', ['clean'], () => { rewrite_polyfills: false, new_type_inf: true, externs: [ - 'externs/closure-upstream-externs.js', + // 'externs/closure-upstream-externs.js', 'externs/webcomponents-externs.js', 'externs/polymer-externs.js', 'externs/closure-types.js', @@ -140,21 +136,53 @@ gulp.task('closure', ['clean'], () => { .pipe(() => new OldNameStream(closureStream.fileList_)) // process source files in the project - const sources = project.sources() + const sources = project.sources(); // process dependencies - const dependencies = project.dependencies() + const dependencies = project.dependencies(); + + class Uniq extends Transform { + constructor() { + super({ objectMode: true }); + this.map = {}; + } + _transform(file, enc, cb) { + this.map[file.path] = file; + cb(); + } + _flush(done) { + for (let filePath in this.map) { + let file = this.map[filePath]; + this.push(file); + } + done(); + } + } + + class NoDeps extends Transform { + constructor() { + super({objectMode: true}); + } + _transform(file, enc, cb) { + if (file.path.match(/shadycss/)) { + file.contents = new Buffer(''); + } + cb(null, file); + } + } // merge the source and dependencies streams to we can analyze the project const mergedFiles = mergeStream(sources, dependencies); const splitter = new polymer.HtmlSplitter(); return mergedFiles - .pipe(project.bundler) + .pipe(new NoDeps()) + .pipe(project.bundler()) + .pipe(new Uniq()) .pipe(splitter.split()) + .pipe(new Log('saw:')) .pipe(gulpif(splitRx, closurePipeline())) .pipe(splitter.rejoin()) - // .pipe(htmlmin({removeComments: true})) .pipe(gulpif(joinRx, minimalDocument())) .pipe(gulpif(joinRx, size({title: 'closure size', gzip: true, showTotal: false, showFiles: true}))) .pipe(gulp.dest(COMPILED_DIR)) diff --git a/package.json b/package.json index 49406cea4b..7eeb010799 100644 --- a/package.json +++ b/package.json @@ -8,11 +8,11 @@ "test": "test" }, "devDependencies": { - "babel-preset-babili": "0.0.10", + "babel-preset-babili": "0.0.12", "del": "^2.2.1", "dom5": "^1.3.1", - "eslint-plugin-html": "^1.3.0", - "google-closure-compiler": "^20170218.0.0", + "eslint-plugin-html": "^2.0.1", + "google-closure-compiler": "^20170409.0.0", "gulp": "^3.9.1", "gulp-audit": "^1.0.0", "gulp-babel": "^6.1.2", @@ -24,7 +24,7 @@ "gulp-vulcanize": "^6.0.1", "lazypipe": "^1.0.1", "merge-stream": "^1.0.1", - "polymer-build": "0.8.3", + "polymer-build": "^1.1.0", "run-sequence": "^1.1.0", "through2": "^2.0.0", "web-component-tester": "^6.0.0-prerelease.4"