Semi-colons sometimes allowed
Closed this issue · 3 comments
Looks like semi-colons are sometimes permitted:
$pink: #ffc3cd
$black: #000
body
background: $pink;
color: $black;
While in other situations, they error as expected:
@import "part";
$pink: #ffc3cd;
$black: #000;
Testing through Node-sass v0.9.3, I’d be happy to do a PR here but it looks like most of the testing is through the Perl version, right?
I guessed from the specs that the semicolon should not be allowed in indented syntax (since it is superflous). Currently sass2scss converts your code from above to:
$pink: #ffc3cd;
$black: #000;
body {
background: $pink;;
color: $black;; }
@import "part";;
$pink: #ffc3cd;;
$black: #000;;
What you actually see is the behaviour of libsass. I'm pretty sure you're getting the "invalid top-level expression" error. This one is thrown when libsass finds an empty top-level expression. Which in this case means it chokes on the two semicolons, since in between libsass sees an empty top-level expression. Once inside a scope block it will simply ignore the empty expressions.
I guess it will not be to hard to make that semicolon optional, so the final result will only have one.
And yes, I have my sass2scss test cases within the Perl Module since that already had a test suite set up. Added your use case also to my test suite here mgreter/perl-libsass@54bb2c4.
Thanks for taking care of that so quickly 🍻