Skip to content

Commit a0503c7

Browse files
committed
add silent option
1 parent f5b90ae commit a0503c7

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@ module.exports = function(css, options){
6969
*/
7070

7171
function error(msg) {
72+
if(options.silent === true){
73+
return false;
74+
}
7275
var err = new Error(msg + ' near line ' + lineno + ':' + column);
7376
err.filename = options.source;
7477
err.line = lineno;

test/css-parse.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,18 @@ describe('parse(str)', function(){
6666
parse('p { color:; }');
6767
});
6868
});
69+
70+
it('should not throw with silent option', function () {
71+
assert.doesNotThrow(function(){
72+
parse('thing { color: red; } /* b { color: blue; }',{ silent: true });
73+
});
74+
75+
/* Nested comments should be fine */
76+
assert.doesNotThrow(function(){
77+
parse('/* /* */');
78+
});
79+
});
80+
81+
82+
6983
});

0 commit comments

Comments
 (0)