From 3338dc2e9231d1c52b1e64e26b942943c8df94af Mon Sep 17 00:00:00 2001 From: Juanfran Date: Mon, 2 Mar 2015 10:24:54 +0100 Subject: [PATCH] scss-lint git hook --- gulpfile.js | 3 +++ package.json | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 8e257762..0d9ae11c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -165,6 +165,8 @@ gulp.task("scss-lint", [], function() { "!" + paths.app + "/styles/components/markitup.scss" ]; + var fail = process.argv.indexOf("--fail") !== -1; + return gulp.src(paths.sass.concat(ignore)) .pipe(gulpif(!isDeploy, cache(scsslint({endless: true, sync: true, config: "scsslint.yml"}), { success: function(scsslintFile) { @@ -176,6 +178,7 @@ gulp.task("scss-lint", [], function() { }; } }))) + .pipe(gulpif(fail, scsslint.failReporter())) }); gulp.task("sass-compile", ["scss-lint"], function() { diff --git a/package.json b/package.json index a1f81bd5..318a93a3 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,9 @@ "url": "https://github.com/taigaio/taiga-front/blob/master/LICENSE" } ], + "scripts": { + "scss-lint": "gulp scss-lint --fail" + }, "devDependencies": { "coffee-script": "^1.9.0", "del": "^1.1.1", @@ -45,8 +48,12 @@ "gulp-template": "^2.1.0", "gulp-uglify": "~1.1.0", "gulp-wrap": "^0.10.1", + "pre-commit": "^1.0.5", "readable-stream": "~1.0.33", "run-sequence": "^1.0.2", "through2": "~0.6.3" - } + }, + "pre-commit": [ + "scss-lint" + ] }