Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gulp autoprefixer doesn't add moz prefix

I am using gulp with autoprefixer in my project, and I have to use backgrounds gradient like this:

background: linear-gradient(#e98a00, #f5aa2f);

but output is:

background:-webkit-linear-gradient(#e98a00,#f5aa2f);
background:linear-gradient(#e98a00,#f5aa2f);

What wrong with me?

Part of Gulpfile.js

gulp.task('styles', function() {
  return gulp.src(['css/less/mainPage.less'])
    .pipe(plumber())
    // .pipe(concat('base.scss'))
    .pipe(less())
    .pipe(prefix([{ browsers: ['IE 8', 'IE 9', 'last 5 versions', 'Firefox 14', 'Opera 11.1'] }]))
    .pipe(minifyCSS({keepBreaks: true}))
    .pipe(gulp.dest('css'))
    .pipe(connect.reload());
}); 

Iam using gulp-autoprefixer

even if Iam setting

 browsers: ['Firefox 14']

output still:

 background:-webkit-linear-gradient(#e98a00,#f5aa2f);
 background:linear-gradient(#e98a00,#f5aa2f);
like image 592
betmakh Avatar asked Sep 29 '14 10:09

betmakh


1 Answers

Use "autoprefixer-core" with "gulp-postcss". Usage example :

var MASK_SRC = "./src/mask/page0/";

var gulp = require("gulp")
var plumber = require("gulp-plumber")
var postcss = require('gulp-postcss');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('autoprefixer-core');
var csso = require("gulp-csso")

gulp.task("styles", function() {
    return gulp.src(MASK_SRC + "scss/*.css")
    //.pipe(plumber())
    .pipe(postcss([ autoprefixer({ browsers: ["> 0%"] }) ]))
    //.pipe(csso())
    .pipe(gulp.dest(MASK_SRC + "/css/"))
})

gulp.task("dev", ["styles"], function() {
  gulp.watch(MASK_SRC + "scss/**/*", function(event) {
    gulp.run("styles")
  })
})
like image 200
user4684527 Avatar answered Sep 29 '22 08:09

user4684527