Gulp Sass not compiling partials

后端 未结 6 1927
爱一瞬间的悲伤
爱一瞬间的悲伤 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:19

    A bit late for the show, but if I understand you right; you want to run your build when you change ANY scss file, whether that being a partial or not, right? (but not including the partials in the build itself – as that is handled by sass @import).

    I normally use this approach:

    var scss_source = [ 'path/to/scss' ],
        partials_source = [ 'path/to/partials' ];
    
    gulp.task('scss', function () {
        gulp.src( scss_source )
        ...
    });
    
    var scss_watcher = gulp.watch([ scss_source, partials_source ], [ 'scss' ]);
    

    I pass only the scss_source to the build, but BOTH sources to the watcher. That way I can seperate all partials from the rest of the scss sources, but have changes to any of the files trigger a build. And I don't have to include yet another module for handling this.

    I usually keep my partials in separate directories (think shared, and not mixed with other scss files).

    Hope this makes sense in your case – otherwise I do apologize.

提交回复
热议问题