Skip to content

Commit

Permalink
Merge pull request csscomb#506 from renuo/feature/process-empty-files
Browse files Browse the repository at this point in the history
fix endless loop with empty files
  • Loading branch information
obenjiro authored May 29, 2017
2 parents 586e7aa + cdc3da4 commit a7971f2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,11 @@ class Comb {
let filename = options && options.filename || '';
let context = options && options.context;
let tree;
const lint = this.lint;

if (!text) return this.lint ? [] : text;
if (!text) return new Promise(function(resolve) {
resolve(lint ? [] : text);
});

if (!syntax) syntax = 'css';
this.syntax = syntax;
Expand Down
Empty file added test/core/scss/empty.scss
Empty file.
7 changes: 7 additions & 0 deletions test/core/scss/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,13 @@ describe('scss', function() {
return test.shouldBeEqual('content.scss');
});

it('Should parse an empty file', function() {
let test = new Test(this);
test.comb.configure({});

return test.shouldBeEqual('empty.scss');
});

it('Should parse functions', function() {
let test = new Test(this);
test.comb.configure({});
Expand Down

0 comments on commit a7971f2

Please sign in to comment.