G
G
GaserV2016-09-01 11:12:37
Sass
GaserV, 2016-09-01 11:12:37

How to run autoprefixer + sass in gulp?

Comrades, tell me please. I'm still green in gallop. How can I run autoprefixer + sass in the console?

var gulp = require('gulp');

var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');

gulp.task('sass',function(){
  gulp.src('./sass/*.sass')
    .pipe(sass().on('error', sass.logError))
    .pipe(gulp.dest('./css/'))
})

gulp.task('sass:watch',function(){
  gulp.watch('./sass/*.sass', ['sass'])
}

 
gulp.task('default', () =>
    gulp.src('./css/main.css')
        .pipe(autoprefixer({
            browsers: ['> 1%', 'IE 8'], 
            cascade: false
        }))
        .pipe(gulp.dest('dist'))
);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sergey, 2016-09-01
@zorro76

Well, or like this, we write gulp styles in the console and everything is fine with your styles:

gulp.task('styles', function() {
    gulp.src(src.sass)
    .pipe(sass({
            "sourcemap=none": true,
            noCache: true,
            compass: true,
            style: sassStyle,
            lineNumbers: false
        }))
    .pipe(autoPrefixer())   
    .pipe(gulp.dest(outputDir + 'css'))
    .pipe(connect.reload())
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question