Gulp doesn't ignore SASS partials with underscore

旧巷老猫 提交于 2019-12-12 03:24:50

问题


My tasks are as follows:

gulp.task('sass', function () {
gulp.src(paths.webroot + '/css/**/*.scss')
  .pipe(sass().on('error', sass.logError))
  .pipe(gulp.dest(paths.webroot + '/css'));
});

gulp.task('sass:watch', function () {
gulp.watch(paths.webroot + 'css/**/*.scss', ['sass']);
});

My folder structure:

css
  libs
     _partial1.scss
     _partial2.scss
  main.scss

How can I ignore all files with underscore or go after only top level files in css (ignoring libs)


回答1:


To go after only top level files in css/ and ignore css/libs, do:

gulp.src(paths.webroot + '/css/*.scss') .pipe(sass().on('error', sass.logError)) .pipe(gulp.dest(paths.webroot + '/css')); });

I'm guessing you're already importing the partials in your main.scss or some other top level file.



来源:https://stackoverflow.com/questions/32657255/gulp-doesnt-ignore-sass-partials-with-underscore

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