66var settings = {
77 clean : true ,
88 scripts : true ,
9- polyfills : true ,
9+ componentScripts : true ,
10+ polyfills : false ,
1011 styles : true ,
1112 templates : true ,
1213 svgs : true ,
@@ -25,6 +26,7 @@ var paths = {
2526 scripts : {
2627 input : 'src/js/*' ,
2728 polyfills : '.polyfill.js' ,
29+ components : 'src/components/**/*.js' ,
2830 output : 'dist/js/'
2931 } ,
3032 styles : {
@@ -203,14 +205,28 @@ var buildScripts = function (done) {
203205
204206} ;
205207
208+ // Concat JS in components
209+ var concatComponentScripts = function ( done ) {
210+
211+ if ( ! settings . componentScripts ) return done ( ) ;
212+
213+ // Run tasks on JS files in components folders
214+ return src ( paths . scripts . components )
215+ . pipe ( sourcemaps . init ( ) )
216+ . pipe ( concat ( 'components.js' ) )
217+ . pipe ( sourcemaps . write ( '.' ) )
218+ . pipe ( dest ( paths . scripts . output ) ) ;
219+ } ;
220+
221+
206222// Lint scripts
207223var lintScripts = function ( done ) {
208224
209225 // Make sure this feature is activated before running
210226 if ( ! settings . scripts ) return done ( ) ;
211227
212228 // Lint scripts
213- return src ( paths . scripts . input )
229+ return src ( [ paths . scripts . input , paths . scripts . components ] )
214230 . pipe ( jshint ( ) )
215231 . pipe ( jshint . reporter ( 'jshint-stylish' ) ) ;
216232
@@ -337,6 +353,7 @@ exports.default = series(
337353 cleanDist ,
338354 parallel (
339355 buildScripts ,
356+ concatComponentScripts ,
340357 lintScripts ,
341358 buildStyles ,
342359 buildTemplates ,
0 commit comments