8

I have a build command for my Sass styles like this:

sass src/styles/main.scss --style compressed | autoprefixer -b \"> 1%, IE 8\" > dist/main.css

Now, I would like to have a similar command for the developement process. But I can't figure out how to pipe the files changed by sass --watch to the autoprefixer cli. I managed to get around it with fswatch tool for OSX but I hope for an easier and more universal solutiond

penzington
  • 81
  • 3
  • 1
    What did you find out here? I've been trying to watch a dir and pipe those files to autoprefixer but finding clear examples is tough. Just using gulp for the time being. – Bill Criswell Aug 05 '15 at 03:19

1 Answers1

0

Have you checked out gulp? It would be really easy to do what you want with the gulp-sass and gulp-autoprefixer node packages.

Something like this in your gulpfile.js:

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

gulp.task('scss', function() {
    return gulp.src('path/to/styles.scss')
    .pipe(sass())
    .pipe(autoprefixer())
    .pipe(gulp.dest('path/to/css'))
});
Oskar
  • 181
  • 2
  • 9