File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,7 +9,9 @@ gulp.task('js', () => {
99 ] ;
1010
1111 return gulp . src ( src )
12- . pipe ( overridePaths ( ) )
12+ . pipe ( overridePaths ( {
13+ overrideOnlyContent : true ,
14+ } ) )
1315 . pipe ( babel ( ) )
1416 . pipe ( gulp . dest ( `build/${ require ( './theme' ) . name } ` ) ) ;
1517} ) ;
Original file line number Diff line number Diff line change @@ -11,16 +11,20 @@ const rewrites = {
1111 [ path . resolve ( './src' ) ] : path . resolve ( `./themes/${ themeName } ` ) ,
1212} ;
1313
14- function overridePaths ( ) {
14+ function overridePaths ( options = { overrideOnlyContent : false } ) {
1515 return through . obj ( ( file , enc , cb ) => {
1616 for ( let from in rewrites ) {
1717 if ( file . path . indexOf ( from ) === 0 ) {
1818 const newPath = file . path . replace ( from , rewrites [ from ] ) ;
1919 if ( fs . existsSync ( newPath ) ) {
2020 console . info ( `override ${ file . path } -> ${ newPath } ` ) ;
21- file = vinylFile . readSync ( newPath , {
22- base : rewrites [ from ] ,
23- } ) ;
21+ if ( options . overrideOnlyContent ) {
22+ file . contents = fs . readFileSync ( newPath ) ;
23+ } else {
24+ file = vinylFile . readSync ( newPath , {
25+ base : rewrites [ from ] ,
26+ } ) ;
27+ }
2428 break ;
2529 }
2630 }
You can’t perform that action at this time.
0 commit comments