postcss / sugarss

Indent-based CSS syntax for PostCSS

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

thevtm opened this issue · comments

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

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 */

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.

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

Released in 1.0.1