Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Break if no diff #5

Open
JacobDB opened this issue Jan 18, 2016 · 1 comment
Open

Break if no diff #5

JacobDB opened this issue Jan 18, 2016 · 1 comment

Comments

@JacobDB
Copy link

JacobDB commented Jan 18, 2016

I'm trying to use this module to only overwrite a file if there's a change. Is there a way to say "if no difference, stop the task" ?

My current gulpfile:

var gulp = require("gulp"),
    json = require("json-file"),

    diff = require("gulp-diff"),

    sass = require("gulp-sass"),
    autoprefixer = require("gulp-autoprefixer"),

    src = "./src",
    dev = "./dev";

gulp.task("default", function() {
    return gulp.src(src + "/assets/styles/all.scss")
        .pipe(sass().on("error", sass.logError))
        .pipe(autoprefixer("last 2 version", "ie 8", "ie 9"))

        .pipe(diff(dev + "/assets/styles"))
        .pipe(diff.reporter()) // if this returns anything, skip gulp.dist

        .pipe(gulp.dest(dev + "/assets/styles"));
});
@JacobDB
Copy link
Author

JacobDB commented Jan 18, 2016

Secondary question: If it's the first time I'm compiling, the dev folder doesn't exist, so it throughs an error. Is there an option i could add to diff() to say "skip this if the folder doesn't exist, rather than throwing an error"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant