我在一些sass文件中有自定义语法,autoprefixer会出错。我想在源文件上运行autoprefixer - 不包括使用自定义语法的文件 - 然后在之后使用css-import。
当前任务:
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
和gulp-if
,但还没有运气。我也能够使用autoprefixed文件创建一个临时文件夹,但Gulp应该有办法避免这种情况。