Skip to content

Commit

Permalink
Cannot read property 'map' of null #8 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
lackhurt committed May 5, 2017
1 parent 118e19f commit 3409c55
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 1 deletion.
8 changes: 8 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ module.exports = function (grunt) {
files: {
'tmp/simple_concat/all.css': ['test/fixtures/style/all.css']
}
},
file_without_import: {
options: {

},
files: {
'tmp/simple_concat/without_import.css': ['test/fixtures/style/without_import.css']
}
}
},
// Unit tests.
Expand Down
2 changes: 1 addition & 1 deletion tasks/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var path = require('path');
* @returns {Array}
*/
function parseExtraCss(content) {
var matches = content.match(IMPORT_REG);
var matches = content.match(IMPORT_REG) || [];

return matches.map(function(importStr) {
var matches = importStr.match(PATH_REG);
Expand Down
7 changes: 7 additions & 0 deletions test/css_import_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ exports.css_import = {
var expected = grunt.file.read('test/expected/simple_concat/all.css');
test.equal(actual, expected, 'This is a simple concat');

test.done();
},
file_without_import: function(test) {
var actual = grunt.file.read('tmp/simple_concat/without_import.css');
var expected = grunt.file.read('test/expected/simple_concat/without_import.css');
test.equal(actual, expected, 'This is a simple concat');

test.done();
}
};
3 changes: 3 additions & 0 deletions test/expected/simple_concat/without_import.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
h1 {

}
3 changes: 3 additions & 0 deletions test/fixtures/style/without_import.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
h1 {

}

0 comments on commit 3409c55

Please sign in to comment.