基于src有条件地运行gulp任务
我在一些sass文件中使用了自定义语法,autoprefixer将在其中出错。我希望在源文件上运行autoprefixer(不包括具有自定义语法的文件),然后使用css导入 当前任务:基于src有条件地运行gulp任务,gulp,tooling,gulp-autoprefixer,Gulp,Tooling,Gulp Autoprefixer,我在一些sass文件中使用了自定义语法,autoprefixer将在其中出错。我希望在源文件上运行autoprefixer(不包括具有自定义语法的文件),然后使用css导入 当前任务: gulp.task('autoprefixer', function() { gulp.src('src/stylesheets/**/*.*') // On all but the following, autoprefix: // - src/stylesheets/file1.scss.
gulp.task('autoprefixer', function() {
gulp.src('src/stylesheets/**/*.*')
// On all but the following, autoprefix:
// - src/stylesheets/file1.scss.liquid
// - src/stylesheets/file1.scss.liquid
.pipe(autoprefixer())
// On all files not prefaced with underscore, css import
// - src/stylesheets/[^_]*.*
.pipe(cssimport())
// Print to dist/
.pipe(gulp.dest('dist/'));
});
我试过使用
merge2
和gulpif
,但运气不好。我还可以创建一个包含自动刷新文件的临时文件夹,但Gulp应该有办法避免这种情况。无论如何,我没有找到解决方案。自定义语法分析器设置起来很麻烦,在我的情况下不值得。