postcss / sugarss

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

"TypeError: this.current.push is not a function" on indented comments #62

Closed thevtm closed 6 years ago

thevtm commented 6 years ago

Hi! I've been using SugarSS a lot lattely and I'm really enjoying it! :smile:

So I found a little bug when indenting comments. This code:

// foo
  // baz

Results in this error:

ERROR in /PROJECT_PATH/node_modules/file-loader/dist/cjs.js?{ "name": "bundle.css" }!/PROJECT_PATH/node_modules/postcss-loader/lib!../css/index.sss
Module build failed: TypeError: this.current.push is not a function
    at Parser.init (/PROJECT_PATH/node_modules/sugarss/parser.js:256:22)
    at Parser.comment (/PROJECT_PATH/node_modules/sugarss/parser.js:94:14)
    at Parser.loop (/PROJECT_PATH/node_modules/sugarss/parser.js:52:22)
    at parse (/PROJECT_PATH/node_modules/sugarss/parse.js:34:12)
    at new LazyResult (/PROJECT_PATH/node_modules/postcss/lib/lazy-result.js:66:24)
    at Processor.process (/PROJECT_PATH/node_modules/postcss/lib/processor.js:117:12)
    at Promise.resolve.then.then (/PROJECT_PATH/node_modules/postcss-loader/lib/index.js:143:8)
    at <anonymous>
 @ ./webpack.js 6:0-79
 @ ./index.js

I expected it to work just fine. This situation happens every now and them so I managed to find a workaround:

// foo
//   baz

I've also found that the same error happens with /* */ comments.

/* foo */
  /* baz */
ai commented 6 years ago

Thanks for big report. Sorry, I will have time to fix it only in the November, after my ReactiveConf talk.

But seems like it is not urgent and can wait few weeks.

thevtm commented 6 years ago

No problem, it's definitely not urgent. Good luck on your talk! :+1:

ai commented 6 years ago

Done dea5e73

ai commented 6 years ago

Released in 1.0.1