有条件地运行基于src的gulp任务

时间:2015-11-20 16:39:27

标签: gulp tooling gulp-autoprefixer

我在一些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/'));
});

我尝试过使用merge2gulp-if,但还没有运气。我也能够使用autoprefixed文件创建一个临时文件夹,但Gulp应该有办法避免这种情况。

0 个答案:

没有答案
相关问题