Skip to content

Commit 78a9945

Browse files
committed
Updated CssSyntaxError check
1 parent 95a20db commit 78a9945

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ return gulp.src('./src/*.css')
7070

7171
## Changelog
7272

73+
* 5.1.5
74+
* Updated `CssSyntaxError` check
75+
7376
* 5.1.4
7477
* Simplified error handling
7578
* Simplified postcss execution with object processors

index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ var postcss = require('postcss')
33
var applySourceMap = require('vinyl-sourcemaps-apply')
44
var gutil = require('gulp-util')
55
var path = require('path')
6-
var CssSyntaxError = require('postcss/lib/css-syntax-error')
76

87

98
module.exports = function (processors, options) {
@@ -70,7 +69,7 @@ module.exports = function (processors, options) {
7069

7170
function handleError (error) {
7271
var errorOptions = { fileName: file.path }
73-
if (error instanceof CssSyntaxError) {
72+
if (error.name === 'CssSyntaxError') {
7473
error = error.message + error.showSourceCode()
7574
errorOptions.showStack = false
7675
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "gulp-postcss",
3-
"version": "5.1.5",
3+
"version": "5.1.6",
44
"description": "PostCSS gulp plugin",
55
"main": "index.js",
66
"scripts": {

test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ describe('PostCSS Guidelines', function () {
116116

117117
var sandbox = sinon.sandbox.create()
118118
var CssSyntaxError = function (message, sourceCode) {
119+
this.name = 'CssSyntaxError'
119120
this.message = message
120121
this.sourceCode = sourceCode
121122
this.showSourceCode = function () {
@@ -130,7 +131,6 @@ describe('PostCSS Guidelines', function () {
130131
postcss: function () {
131132
return postcssStub
132133
}
133-
, 'postcss/lib/css-syntax-error': CssSyntaxError
134134
})
135135

136136
beforeEach(function () {

0 commit comments

Comments
 (0)