Comparing version 0.5.2 to 0.6.0
@@ -34,2 +34,4 @@ var map = require('map-stream') | ||
opts.success = function (css) { | ||
if (typeof opts.onSuccess === 'function') opts.onSuccess(css); | ||
file.path = ext(file.path, '.css'); | ||
@@ -45,2 +47,8 @@ file.contents = new Buffer(css); | ||
} | ||
if (typeof opts.onError === 'function') { | ||
opts.onError(err); | ||
return cb(); | ||
} | ||
return cb(new gutil.PluginError('gulp-sass', err)); | ||
@@ -47,0 +55,0 @@ }; |
{ | ||
"name": "gulp-sass", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"description": "Gulp plugin for sass", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -33,6 +33,14 @@ [![Build Status](https://travis-ci.org/dlmanning/gulp-sass.png?branch=master)](https://travis-ci.org/dlmanning/gulp-sass) | ||
#### `errLogToConsole` | ||
#### `errLogToConsole: true` | ||
If you pass `errLogToConsole: true` into the options hash, sass errors will be logged to the console instead of generating a `gutil.PluginError` object. Use this option with `gulp.watch` to keep gulp from stopping every time you mess up your sass. | ||
#### `onSuccess: callback` | ||
Pass in your own callback to be called upon successful compilaton by node-sass. The callback has the form `callback(css)`, and is passed the compiled css as a string. Note: This *does not* prevent gulp-sass's default behavior of writing the output css file. | ||
#### `onError: callback` | ||
Pass in your own callback to be called upon a sass error from node-sass. The callback has the form `callback(err)`, where err is the error string generated by libsass. Note: this *does* prevent an actual `gulpPluginError` object from being created. | ||
#Imports and Partials | ||
@@ -39,0 +47,0 @@ |
@@ -95,2 +95,16 @@ var assert = require('assert'); | ||
stream.write(errorFile); | ||
}); | ||
test('call custom error callback when opts.onError is given', function (t) { | ||
var stream = gsass({ onError: function (err) { | ||
t.equal(err, | ||
'source string:1: error: property "font" must be followed by a \':\'\n' | ||
); | ||
t.end(); | ||
}}); | ||
var errorFile = createVinyl('somefile.sass', | ||
new Buffer('body { font \'Comic Sans\'; }')); | ||
stream.write(errorFile); | ||
}); |
9655
173
74