Skip to content

Commit 7cb111d

Browse files
committed
feat(gulp:injector): Add Sass injector
1 parent 79cf0dd commit 7cb111d

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

app/templates/gulpfile.babel.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var paths = {
2727
'!client/bower_components/**/*.js'
2828
],
2929
styles: ['client/{app, components}/**/*.<% if(filters.stylus) { %>styl<% } else if (filters.sass) { %>scss<% } else { %>css<% } %>'],
30+
mainStyle: 'client/app/app.<% if(filters.stylus) { %>styl<% } else if (filters.sass) { %>scss<% } else { %>css<% } %>',
3031
test: ['client/**/*.spec.<% if(filters.coffee) { %>coffee<% } else { %>js<% } %>'],
3132
testRequire: [
3233
'client/bower_components/angular/angular.js',
@@ -147,6 +148,17 @@ gulp.task('inject:css', () => {
147148
.pipe(gulp.dest('client'));
148149
});
149150

151+
// TODO: other styles
152+
gulp.task('inject:sass', () => {
153+
return gulp.src('client/app/app.scss')
154+
.pipe(plugins.inject(gulp.src(_.union(paths.client.styles, ['!' + paths.client.mainStyle]), {read: false}), {
155+
starttag: '/*injector:sass*/',
156+
endtag: '/*endinjector*/',
157+
transform: (filepath) => '@import \'' + filepath.replace('/client/app/', '').replace('/client/components/', '../components/') + '\';'
158+
}))
159+
.pipe(gulp.dest('client/app'));
160+
});
161+
150162
gulp.task('styles', styles);<% if(filters.coffee) { %>
151163

152164
gulp.task('coffee', () =>

0 commit comments

Comments
 (0)