postcss / sugarss

Indent-based CSS syntax for PostCSS
MIT License
707 stars 39 forks source link

Comments with no content throw error. #48

Closed whaaaley closed 8 years ago

whaaaley commented 8 years ago

in

//

out

events.js:160
      throw er; // Unhandled 'error' event
      ^
TypeError: Cannot read property '2' of null
    at Parser.commentText (/Users/dustindowell/Github/plump/node_modules/sugarss/parser.js:330:26)
    at Parser.comment (/Users/dustindowell/Github/plump/node_modules/sugarss/parser.js:85:14)
    at Parser.loop (/Users/dustindowell/Github/plump/node_modules/sugarss/parser.js:52:22)
    at parse (/Users/dustindowell/Github/plump/node_modules/sugarss/parse.js:33:12)
    at new LazyResult (/Users/dustindowell/Github/plump/node_modules/postcss/lib/lazy-result.js:80:24)
    at Processor.process (/Users/dustindowell/Github/plump/node_modules/postcss/lib/processor.js:200:12)
    at Transform.stream._transform (/Users/dustindowell/Github/plump/node_modules/gulp-postcss/index.js:48:8)
    at Transform._read (_stream_transform.js:167:10)
    at Transform._write (_stream_transform.js:155:12)
    at doWrite (_stream_writable.js:307:12)

This happens a lot when I'm quickly commenting out chunks of code with empty lines, like this. The empty line in the middle would cause an error.

// .foo {
//   margin: 0;
// }
// 
// .bar {
//   padding: 10px;
// }
ai commented 8 years ago

Fixed b1d568d

ai commented 8 years ago

Released in 0.1.6. Thanks for report :).