Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gulp 自动刷新器不';不要添加供应商前缀_Gulp_Postcss_Autoprefixer - Fatal编程技术网

Gulp 自动刷新器不';不要添加供应商前缀

Gulp 自动刷新器不';不要添加供应商前缀,gulp,postcss,autoprefixer,Gulp,Postcss,Autoprefixer,任务如下: gulp.task('process-css', function(){ return gulp.src('./app/css/scss/main.scss') .pipe(sass().on('error', sass.logError)) .pipe(postcss([postcssMixins, postcssCalc, postcssSimpleVars, postcssColor, postcssExtend, postcssNesting, autop

任务如下:

gulp.task('process-css', function(){
  return gulp.src('./app/css/scss/main.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(postcss([postcssMixins, postcssCalc, postcssSimpleVars, postcssColor, postcssExtend, postcssNesting, autoprefixer])) 
    .on('error', function(errorHandler){
      console.log(errorHandler.toString());
      this.emit('end');
    })
    .pipe(concatCSS('style.css'))
    .pipe(gulp.dest('./app/css/'));
});
我使用的是标准的autoprefixer插件(不是gulp autoprefixer,它在我使用的上一个任务运行程序中基本上做了相同的事情),但它只添加了-webkit-前缀。我尝试了clip path和display:flex等属性,但它没有添加供应商前缀。我试着把线路改成

 .pipe(postcss([
 postcssMixins, postcssCalc, postcssSimpleVars,
 postcssColor, postcssExtend, postcssNesting,
 autoprefixer([{browsers: '> 0%'}])) 
但那也不行,有什么问题吗

--固定-- 我想其他一些插件也在使用AutoRefixer,这会干扰我的配置。我修复它的方法是将其添加到package.json文件的底部

"browserslist": [
    "> 0%",
    "last 2 versions"
  ]

在devdependency的最后一个大括号后添加逗号。Flex得到了很好的支持,因此您可能不再需要它了(autoprefixer默认情况下暂时不再向属性添加前缀-请检查是否可以使用)。但如果您确实需要,您可以执行以下步骤:

  • 假设您的工作目录中有用于样式的
    css
    文件夹和
    dist
    文件夹
  • 在工作目录的根目录下创建.browsslistrc文件,并将
    最后4个版本
    放入其中
  • 在终端中运行
    postsss css/styles.css-u autoprefixer-o dist/styles.css