Skip to content

Commit

Permalink
fixes ded#24 - parsing empty multiline comments
Browse files Browse the repository at this point in the history
  • Loading branch information
yomed committed Jul 1, 2015
1 parent 337dbf4 commit 9ee466c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function sqwish(css, strict) {
css = css.trim() // give it a solid trimming to start

// comments
.replace(/\/\*[\s\S]+?\*\//g, '')
.replace(/\/\*[\s\S]*?\*\//g, '')

// line breaks and carriage returns
.replace(/[\n\r]/g, '')
Expand Down
7 changes: 7 additions & 0 deletions tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ sink('basic mode', function (test, ok) {
ok(actual == expected, 'all appropriate whitespace was removed')
})

test('comments', 1, function () {
var input = '/**/p{color:blue}/**/'
, expected = 'p{color:blue}'
, actual = sqwish.minify(input)
ok(actual == expected, 'empty multiline comments removed')
})

test('long hex to short hex', 1, function () {
var input = 'p { color: #ffcc33; }'
, expected = 'p{color:#fc3}'
Expand Down

0 comments on commit 9ee466c

Please sign in to comment.