问题
I have this angular2 project structure (showing the part where i have the problem ) :
|templates
|index
-index.scss
-index.template.html
|About
-about.scss
-about.template.html
I want to compile all scss files in index and about folders using gulp, and put the compiled files in the same directory as the scss files. Example : index.scss must be compiled and placed in index (folder) as index.css so that the result will be
|templates
|index
-index.scss
-index.css
-index.template.html
how could I compile all of scss files in all templates subfolders using gulp, and the compiled files must be placed in the same subfolder as the scss file ?
回答1:
you can do
gulp.src('./**/**.scss')
.pipe(scss-to-css-plugin())
.pipe(gulp.dest('.')
回答2:
Try this Code
gulp.task('sass-style', function() {
return sass('templates/folder/**/*.scss')
.on('error', sass.logError)
.pipe(gulp.dest(''templates/folder/'));
});
来源:https://stackoverflow.com/questions/38490611/compiling-all-scss-files-in-all-subfolders-using-gulp