compiling all scss files in all subfolders using gulp

痞子三分冷 提交于 2020-01-06 19:28:31

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!