使用gulp编译所有子文件夹中的所有scss文件 [英] compiling all scss files in all subfolders using gulp

查看:144
本文介绍了使用gulp编译所有子文件夹中的所有scss文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  |模板
我有这个angular2项目结构(显示出问题的部分) | index
-index.scss
-index.template.html
|关于
-about.scss
-about.template.html
code>

我想使用gulp编译索引中的所有scss文件,并将编译后的文件放在与scss相同的目录中文件。
示例:必须编译
index.scss并将其作为index.css
放入索引(文件夹)中,以便结果为

  |模板
|索引
-index.scss
-index.css
-index.template.html

如何使用gulp编译所有模板子文件夹中的所有scss文件,并且编译后的文件必须放在同一子文件夹中作为scss文件吗?

解决方案

尝试此代码

$ b

  gulp.task('sass-style',function(){
return sass('templates / folder / ** / *。scss')
.on('error',sass.logError)
.pipe(gulp.dest(''templates / folder /'));

});


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 ?

解决方案

Try this Code

gulp.task('sass-style', function() {
  return sass('templates/folder/**/*.scss')
    .on('error', sass.logError)
    .pipe(gulp.dest(''templates/folder/'));

});

这篇关于使用gulp编译所有子文件夹中的所有scss文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆