@@ -115,6 +115,32 @@ let styles = lazypipe()
115115// Tasks //
116116///////////
117117
118+ gulp . task ( 'inject' , cb => {
119+ runSequence ( [ 'inject:js' , 'inject:css' ] , cb ) ;
120+ } ) ;
121+
122+ gulp . task ( 'inject:js' , ( ) => {
123+ return gulp . src ( paths . views . main )
124+ . pipe ( plugins . inject ( gulp . src ( _ . union (
125+ paths . client . scripts
126+ ) , { read : false } ) , {
127+ starttag : '<!-- injector:js -->' ,
128+ endtag : '<!-- endinjector -->' ,
129+ transform : ( filepath ) => '<script src="' + filepath . replace ( '/client/' , '' ) + '"></script>'
130+ } ) )
131+ . pipe ( gulp . dest ( 'client' ) ) ;
132+ } ) ;
133+
134+ gulp . task ( 'inject:css' , ( ) => {
135+ return gulp . src ( paths . views . main )
136+ . pipe ( plugins . inject ( gulp . src ( '/client/**/*.css' , { read : false } ) , {
137+ starttag : '<!-- injector:css -->' ,
138+ endtag : '<!-- endinjector -->' ,
139+ transform : ( filepath ) => '<link rel="stylesheet" href="' + filepath . replace ( '/client/' , '' ) . replace ( '/.tmp/' , '' ) + '">'
140+ } ) )
141+ . pipe ( gulp . dest ( 'client' ) ) ;
142+ } ) ;
143+
118144gulp . task ( 'styles' , styles ) ; < % if ( filters . coffee ) { % >
119145
120146gulp . task ( 'coffee' , ( ) =>
@@ -171,6 +197,8 @@ gulp.task('watch', () => {
171197gulp . task ( 'serve' , ( callback ) => {
172198 runSequence ( 'clean:tmp' ,
173199 [ 'lint:scripts' ] ,
200+ 'inject:js' ,
201+ 'inject:css' ,
174202 'bower' ,
175203 [ 'start:server' , 'start:client' ] ,
176204 'watch' ,
0 commit comments