Skip to content

Commit ac17fbc

Browse files
committed
Added csslint.failReporter, closes #6. Removed beep on failure, can be added with on('error'). Updated dependencies.
1 parent 70875c5 commit ac17fbc

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

index.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var csslint = require('csslint').CSSLint;
1010

1111
var formatOutput = function(report, file, options) {
1212
if (!report.messages.length) {
13-
return {
13+
return {
1414
success: true
1515
};
1616
}
@@ -81,8 +81,6 @@ var cssLintPlugin = function(options) {
8181
var defaultReporter = function(file) {
8282
var errorCount = file.csslint.errorCount;
8383
var plural = errorCount === 1 ? '' : 's';
84-
85-
process.stderr.write('\x07'); // Send a beep to the terminal so it bounces
8684

8785
gutil.log(c.cyan(errorCount)+' error'+plural+' found in '+c.magenta(file.path));
8886

@@ -124,4 +122,15 @@ cssLintPlugin.reporter = function(customReporter) {
124122
});
125123
};
126124

125+
cssLintPlugin.failReporter = function(){
126+
return es.map(function (file, cb) {
127+
// Nothing to report or no errors
128+
if (!file.csslint || file.csslint.success) {
129+
return cb(null, file);
130+
}
131+
132+
return cb(new gutil.PluginError('gulp-csslint', 'CSSLint failed for '+file.relative), file);
133+
});
134+
};
135+
127136
module.exports = cssLintPlugin;

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"description": "CSSLint plugin for gulp",
55
"main": "index.js",
66
"dependencies": {
7-
"csslint": "~0.10.0",
8-
"gulp-util": "~1.2.0",
9-
"event-stream": "~3.0.18"
7+
"csslint": "^0.10.0",
8+
"event-stream": "^3.1.2",
9+
"gulp-util": "^2.2.14"
1010
},
1111
"devDependencies": {
12-
"should": "~2.1.1",
13-
"mocha": "~1.15.1"
12+
"mocha": "^1.18.2",
13+
"should": "^3.3.1"
1414
},
1515
"scripts": {
1616
"test": "./node_modules/.bin/mocha"

0 commit comments

Comments
 (0)