Gulp Sass not compiling partials

后端 未结 6 1934
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-18 02:49

So I am using Gulp Sass with gulp-changed (i\'ve also tried gulp-newer with the updated syntax changes) and watching all the scs

6条回答
  •  青春惊慌失措
    2021-01-18 03:18

    This might have more to do with how you're including the partials than anything else - have your @imported the partials into your base sass file?

    i.e., does base.scss have

    @import 'partial1';
    @import 'partial2';
    

    Somewhere in there?

    EDIT

    Okay I just ran into a similar issue, I ended up just using gulp-newer + looping through an array to generate the gulp tasks. So it looked something like

    var sassMain = ['base', 'anotherBase'];
    sassMain.forEach(current, function() {
        var src = current + '.scss';        
    
        return gulp.src(src)
          .pipe(newer(destination)
          .pipe(plumber())
          .pipe(sass())
          .pipe(gulp.dest(destination))
    });
    

    Not really the most flexible thing in the world (especially with nested directories for the base url), but kind of gets where you want to be. gulp-cached also almost gets where you want to be without this trickery, but has the same won't-compile-partials issue.

提交回复
热议问题