gulp-postcss
Advanced tools
Comparing version 6.1.0 to 6.1.1
@@ -77,3 +77,3 @@ var Stream = require('stream') | ||
function handleError (error) { | ||
var errorOptions = { fileName: file.path } | ||
var errorOptions = { fileName: file.path, showStack: true } | ||
if (error.name === 'CssSyntaxError') { | ||
@@ -86,3 +86,3 @@ error = error.message + error.showSourceCode() | ||
setImmediate(function () { | ||
cb(new gutil.PluginError('gulp-postcss', error)) | ||
cb(new gutil.PluginError('gulp-postcss', error, errorOptions)) | ||
}) | ||
@@ -89,0 +89,0 @@ } |
{ | ||
"name": "gulp-postcss", | ||
"version": "6.1.0", | ||
"version": "6.1.1", | ||
"description": "PostCSS gulp plugin", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,4 +18,3 @@ # gulp-postcss [](https://travis-ci.org/postcss/gulp-postcss) | ||
var autoprefixer = require('autoprefixer'); | ||
var mqpacker = require('css-mqpacker'); | ||
var csswring = require('csswring'); | ||
var cssnano = require('cssnano'); | ||
@@ -25,4 +24,3 @@ gulp.task('css', function () { | ||
autoprefixer({browsers: ['last 1 version']}), | ||
mqpacker, | ||
csswring | ||
cssnano(), | ||
]; | ||
@@ -59,4 +57,3 @@ return gulp.src('./src/*.css') | ||
var postcss = require('gulp-postcss'); | ||
var autoprefixer = require('autoprefixer'); | ||
var cssnext = require('cssnext'); | ||
var cssnext = require('postcss-cssnext'); | ||
var opacity = function (css, opts) { | ||
@@ -75,5 +72,4 @@ css.eachDecl(function(decl) { | ||
var processors = [ | ||
autoprefixer({browsers: ['last 1 version']}), | ||
cssnext({browsers: ['last 1 version']}), | ||
opacity, | ||
cssnext() | ||
]; | ||
@@ -101,2 +97,5 @@ return gulp.src('./src/*.css') | ||
* 6.1.1 | ||
* Fixed the error output | ||
* 6.1.0 | ||
@@ -103,0 +102,0 @@ * Support for `null` files |
33
test.js
@@ -21,5 +21,5 @@ /* global it, afterEach, beforeEach, describe, Promise */ | ||
}) | ||
stream.write(emptyFile) | ||
stream.end() | ||
@@ -57,2 +57,4 @@ }) | ||
assert.equal(err.plugin, 'gulp-postcss') | ||
assert.equal(err.showStack, false) | ||
assert.equal(err.fileName, 'testpath') | ||
cb() | ||
@@ -62,3 +64,4 @@ }) | ||
stream.write(new gutil.File({ | ||
contents: new Buffer('a {') | ||
contents: new Buffer('a {'), | ||
path: 'testpath' | ||
})) | ||
@@ -70,3 +73,27 @@ | ||
it('should respond with error on stream files', function (cb) { | ||
var stream = postcss([ doubler ]) | ||
stream.on('error', function (err) { | ||
assert.ok(err instanceof gutil.PluginError) | ||
assert.equal(err.plugin, 'gulp-postcss') | ||
assert.equal(err.showStack, true) | ||
assert.equal(err.fileName, 'testpath') | ||
cb() | ||
}) | ||
var streamFile = { | ||
isStream: function () { return true }, | ||
isNull: function() { return false }, | ||
path: 'testpath' | ||
}; | ||
stream.write(streamFile) | ||
stream.end() | ||
}) | ||
it('should throw error if processors are not provided', function (cb) { | ||
@@ -73,0 +100,0 @@ assert.throws( function () { postcss() }, gutil.PluginError ) |
16297
333
177