postcss / gulp-postcss

Pipe CSS through PostCSS processors with a single parse
MIT License
769 stars 65 forks source link

Option to watch only changed files #90

Closed last-partizan closed 8 years ago

last-partizan commented 8 years ago

Hello, is there an option to rebuild only changed files?

Just now i'm using gulp with config like this:

var CSS_DIR = ['./src/sass/*.scss', '!./src/sass/_*.scss'];

gulp.task("dev:css:build", function(){
    return gulp.src(CSS_DIR)
        .pipe(postcss(post_processors, {
            syntax: scss,
        }))
        .pipe(rename({extname: ".css"}))
        .pipe(gulp.dest('../../static/css'));
});
gulp.task("dev:css", function(){
    gulp.watch(CSS_DIR[0], ["dev:css:build"]);
}); 

And after changing some file, it rebuilds all; Is there some magick that rebuilds only changed files? And rebuild dependent files when using "@import" and postcss-import ?

TrySound commented 8 years ago

@last-partizan Here's similar example with less, but imports is the problem here. https://gist.github.com/TrySound/59f346854dc699705dc9141824097fd4

last-partizan commented 8 years ago

Nice idea for filtering only changed files before less, thanks.

w0rm commented 8 years ago

I don't think such magic exists as there is no dependency tree in gulp. You should probably use webpack with postcss loader that seems to have this ability.