diff --git a/Gruntfile.js b/Gruntfile.js index 4017d41..53610ff 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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. diff --git a/tasks/util.js b/tasks/util.js index adbe9ad..a5fc846 100644 --- a/tasks/util.js +++ b/tasks/util.js @@ -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); diff --git a/test/css_import_test.js b/test/css_import_test.js index 1d9e32a..59ea1a9 100644 --- a/test/css_import_test.js +++ b/test/css_import_test.js @@ -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(); } }; diff --git a/test/expected/simple_concat/without_import.css b/test/expected/simple_concat/without_import.css new file mode 100644 index 0000000..12403f2 --- /dev/null +++ b/test/expected/simple_concat/without_import.css @@ -0,0 +1,3 @@ +h1 { + +} \ No newline at end of file diff --git a/test/fixtures/style/without_import.css b/test/fixtures/style/without_import.css new file mode 100644 index 0000000..12403f2 --- /dev/null +++ b/test/fixtures/style/without_import.css @@ -0,0 +1,3 @@ +h1 { + +} \ No newline at end of file