Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby Sass uses indented syntax for .css files #1219

Open
cvrebert opened this issue May 16, 2015 · 12 comments
Open

Ruby Sass uses indented syntax for .css files #1219

cvrebert opened this issue May 16, 2015 · 12 comments

Comments

@cvrebert
Copy link

cvrebert commented May 16, 2015

The hack in question: http://browserhacks.com/#hack-a60b03e301a67f76a5a22221c739dc64

Example:

/* one.css */
@media screen and (min-width:0\0) {
    .bar {
        width: 12px;
    }
}
$ sass -v
Sass 3.4.13 (Selective Steve)
$ sass one.css 
Error: Invalid CSS after "...min-width:0\0) ": expected media query list, was "{"
        on line 1 of one.css
  Use --trace for backtrace.
$ sassc -v
sassc: 3.2.1
libsass: 3.2.4
sass2scss: 1.0.3
$ sassc one.css 
@media screen and (min-width: 0 \0) {
  .bar {
    width: 12px; } }

@xzyfer
Copy link
Contributor

xzyfer commented May 16, 2015

Thanks for the report @cvrebert. There some case where Libsass is more forgiving that Ruby Sass. It's important for us to be aware of these cases.

@xzyfer xzyfer added this to the 3.4 milestone May 16, 2015
@xzyfer
Copy link
Contributor

xzyfer commented May 16, 2015

IMO Ruby Sass shouldn't error here since this is relatively common, and works in CSS. In either case we're producing the wrong output.

@cvrebert
Copy link
Author

Yeah, I agree it would be preferable for Ruby Sass to not error out. I'm just not a Sass guru, so I thought I'd file a discrepancy report here to get some investigation rolling.

@xzyfer
Copy link
Contributor

xzyfer commented May 16, 2015

We appreciate it. I think it'd be worth opening an issue to Ruby Sass to see if the error case can be addressed upstream.

@cvrebert
Copy link
Author

Okay, filed sass/sass#1726

@xzyfer
Copy link
Contributor

xzyfer commented May 16, 2015

Legend.

@cvrebert
Copy link
Author

cvrebert commented Jun 1, 2015

It appears that sass/sass#1726 was not read sufficiently carefully and was thus misunderstood & erroneously closed by the maintainer.

@cvrebert
Copy link
Author

cvrebert commented Jun 5, 2015

Okay, per sass/sass#1726 (comment) this does seem to be a SassC bug rather than a Ruby Sass bug.

mgreter added a commit to mgreter/sass-spec that referenced this issue Jun 13, 2015
mgreter added a commit to mgreter/libsass that referenced this issue Jun 13, 2015
@mgreter mgreter modified the milestones: 3.3, 3.4 Jun 13, 2015
@mgreter mgreter self-assigned this Jun 13, 2015
mgreter added a commit to mgreter/libsass that referenced this issue Jun 23, 2015
mgreter added a commit to mgreter/libsass that referenced this issue Jun 30, 2015
mgreter added a commit to mgreter/libsass that referenced this issue Jun 30, 2015
mgreter added a commit to mgreter/libsass that referenced this issue Jun 30, 2015
xzyfer pushed a commit to xzyfer/libsass that referenced this issue Jul 8, 2015
xzyfer pushed a commit to xzyfer/libsass that referenced this issue Jul 8, 2015
xzyfer pushed a commit to xzyfer/libsass that referenced this issue Jul 8, 2015
xzyfer pushed a commit to xzyfer/libsass that referenced this issue Jul 8, 2015
xzyfer pushed a commit to xzyfer/libsass that referenced this issue Jul 8, 2015
xzyfer pushed a commit to xzyfer/libsass that referenced this issue Jul 8, 2015
xzyfer pushed a commit to xzyfer/libsass that referenced this issue Jul 8, 2015
xzyfer pushed a commit to xzyfer/libsass that referenced this issue Jul 8, 2015
xzyfer pushed a commit to xzyfer/libsass that referenced this issue Jul 8, 2015
xzyfer pushed a commit to xzyfer/libsass that referenced this issue Jul 8, 2015
@mgreter
Copy link
Contributor

mgreter commented Jul 14, 2015

OK, we have no spec now (reverted) for this and if I run the original issue with latest ruby sass I get some output! Therefore it seems we should re-add the spec test and close this issue!

@cvrebert
Copy link
Author

if I run the original issue with latest ruby sass I get some output!

@mgreter Hmm?

$ sass -v
Sass 3.4.16 (Selective Steve)
$ sass one.css 
Error: Invalid CSS after "...min-width:0\0) ": expected media query list, was "{"
        on line 2 of one.css
  Use --trace for backtrace.
$

@mgreter
Copy link
Contributor

mgreter commented Jul 14, 2015

OK, I guess someone should point out that the error is about using the file-ending .css with scss content. Ruby sass seems to default to sass (indented) in that situation. Not sure if we can replicate that behavior easily, since we depend on sass2scss for this kind of syntax.

@mgreter mgreter changed the title Discrepancy with Ruby Sass for CSS with 0\0 media query hack Ruby Sass uses indented syntax for .css files Jul 14, 2015
@mgreter
Copy link
Contributor

mgreter commented Jul 14, 2015

Changing this is rather easy (at least on the "surface") and leads to a similar error:

Error: invalid property name
        on line 2 of foo.css
>> @media screen and (min-width:0\0) { {
   -----------------------------------^

The "strange" output (double bracket) is due to the processing by sass2scss!

@mgreter mgreter modified the milestones: 3.4, 3.3 Jul 15, 2015
@mgreter mgreter removed their assignment Jul 27, 2015
@xzyfer xzyfer modified the milestones: 3.4, 4.0 May 20, 2016
@xzyfer xzyfer removed this from the 4.0 milestone Mar 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants