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

Imports not ordered correctly when using url #45

Closed
vallentin opened this issue Nov 16, 2020 · 3 comments
Closed

Imports not ordered correctly when using url #45

vallentin opened this issue Nov 16, 2020 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@vallentin
Copy link

I notice that the readme mentions "css imports" still remaining. So this might just be a case that hasn't been implemented yet. However, I took a quick look at the imports test cases, and nothing jumped to my eye, so I thought I'd report it anyways.

The @import url("...") is not moved to the top after other @import "..."s have been resolved. The contents of the other imports thereby appear before the @import url("...") in the final output. Which the docs for @import on MDN mentions is not allowed.

Imported rules must precede all other types of rules, except @charset rules; as it is not a nested statement, @import cannot be used inside conditional group at-rules.

My specific case, was that I had an @import url which imported a font. Which resulted in the font never being loaded, given that it was not at the top of the style sheet.

Minimal Reproducible Example:

// style.scss
@import "foo";
@import url("...");

// foo.scss
span {
    color: red;
}

grass Output:

span {
  color: red;
}
@import url("...");

dart-sass Output:

@import url("...");
span {
  color: red;
}
@vallentin vallentin added the bug Something isn't working label Nov 16, 2020
@connorskees
Copy link
Owner

connorskees commented Nov 16, 2020

Thank you for your report! This was a known issue, but so far I had considered it a low priority, as I thought it was more of a cosmetic error, and would not affect the functionality in this way.

This had originally been blocked on a large refactor, but I was able to find a workaround for this bug in f92a071. I'll try to release this as a bugfix version once I track down another error with the most recent version of Bootstrap.

Other missing features are tracked in #19. Thanks!

@connorskees
Copy link
Owner

connorskees commented Nov 16, 2020

I believe this error should be fixed in the newest version of grass, 0.10.4. Please let me know if you run into any further issues!

@vallentin
Copy link
Author

This was a known issue

That's what I expected

I thought it was more of a cosmetic error, and would not affect the functionality in this way

Me too, I was quite confused until I checked MDN.

this error should be fixed in the newest version

Just updated, and everything works as expected now. Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants