gulp-concat-css icon indicating copy to clipboard operation
gulp-concat-css copied to clipboard

Improve error reporting for CSS syntax errors

Open mariocasciaro opened this issue 12 years ago • 1 comments

mariocasciaro avatar Apr 22 '14 18:04 mariocasciaro

Might be related to this issue. If a CSS has an invalid import, like:

/* missing semicolon */
@import "foo"
@import "bar"

gulp-concat-css will throw a quite cryptic error. The issue is in:

// https://github.com/mariocasciaro/gulp-concat-css/blob/master/index.js#L61-L62
var importData = parseImport('@import ' + rule.import + ';');
var importPath = importData && importData[0].path;

parseImport returns an empty array when it couldn't find any imports, so although importData is truthy, import[0] is undefined, and the code blows up. This seems like a good place to add a check if importData[0] exists and, if not, throw a friendlier error.

vitorbaptista avatar Oct 19 '15 11:10 vitorbaptista