@@ -106,11 +106,7 @@ gulp.task('closure', ['clean'], () => {
106106 full ( ) ;
107107
108108 const project = new PolymerProject ( {
109- shell : `./${ entry } ` ,
110- fragments : [
111- 'bower_components/shadycss/apply-shim.html' ,
112- 'bower_components/shadycss/custom-style-interface.html'
113- ]
109+ shell : `./${ entry } `
114110 } ) ;
115111
116112 const closureStream = closure ( {
@@ -123,7 +119,7 @@ gulp.task('closure', ['clean'], () => {
123119 rewrite_polyfills : false ,
124120 new_type_inf : true ,
125121 externs : [
126- 'externs/closure-upstream-externs.js' ,
122+ // 'externs/closure-upstream-externs.js',
127123 'externs/webcomponents-externs.js' ,
128124 'externs/polymer-externs.js' ,
129125 'externs/closure-types.js' ,
@@ -140,21 +136,53 @@ gulp.task('closure', ['clean'], () => {
140136 . pipe ( ( ) => new OldNameStream ( closureStream . fileList_ ) )
141137
142138 // process source files in the project
143- const sources = project . sources ( )
139+ const sources = project . sources ( ) ;
144140
145141 // process dependencies
146- const dependencies = project . dependencies ( )
142+ const dependencies = project . dependencies ( ) ;
143+
144+ class Uniq extends Transform {
145+ constructor ( ) {
146+ super ( { objectMode : true } ) ;
147+ this . map = { } ;
148+ }
149+ _transform ( file , enc , cb ) {
150+ this . map [ file . path ] = file ;
151+ cb ( ) ;
152+ }
153+ _flush ( done ) {
154+ for ( let filePath in this . map ) {
155+ let file = this . map [ filePath ] ;
156+ this . push ( file ) ;
157+ }
158+ done ( ) ;
159+ }
160+ }
161+
162+ class NoDeps extends Transform {
163+ constructor ( ) {
164+ super ( { objectMode : true } ) ;
165+ }
166+ _transform ( file , enc , cb ) {
167+ if ( file . path . match ( / s h a d y c s s / ) ) {
168+ file . contents = new Buffer ( '' ) ;
169+ }
170+ cb ( null , file ) ;
171+ }
172+ }
147173
148174 // merge the source and dependencies streams to we can analyze the project
149175 const mergedFiles = mergeStream ( sources , dependencies ) ;
150176
151177 const splitter = new polymer . HtmlSplitter ( ) ;
152178 return mergedFiles
153- . pipe ( project . bundler )
179+ . pipe ( new NoDeps ( ) )
180+ . pipe ( project . bundler ( ) )
181+ . pipe ( new Uniq ( ) )
154182 . pipe ( splitter . split ( ) )
183+ . pipe ( new Log ( 'saw:' ) )
155184 . pipe ( gulpif ( splitRx , closurePipeline ( ) ) )
156185 . pipe ( splitter . rejoin ( ) )
157- // .pipe(htmlmin({removeComments: true}))
158186 . pipe ( gulpif ( joinRx , minimalDocument ( ) ) )
159187 . pipe ( gulpif ( joinRx , size ( { title : 'closure size' , gzip : true , showTotal : false , showFiles : true } ) ) )
160188 . pipe ( gulp . dest ( COMPILED_DIR ) )
0 commit comments