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
@import url(http://...) Failing For Font URLs #289
Comments
Good catch. You can also @import "http://fonts.googleapis.com/css?family=Titillium+Web:400,300,200,600.css"; But really, this should work too: @import "http://fonts.googleapis.com/css?family=Titillium+Web:400,300,200,600"; |
Libsass should not be "validating" imports that target a remote file (one on the internet). If the URI inside the import statement is remote (which can be ascertained by seeing if it contains a |
I tried your example on the master branch and the import appears in the output (although LibSass doesn't move it to the top of the file the way that Ruby Sass does) ... have you pulled in the past couple of weeks? |
The import has to be at the top of the file. That's clearly in the CSS spec: @import must be at the top. Sent from my iPhone
|
A simplified test case:
Ruby Sass correctly restructures the CSS such that the
Libsass incorrectly produces:
As noted above the CSS spec says: "any @import rules must precede all other rules (except the @charset rule, if present)." Depending on how the Sass is structured, this bug can and will produce code where A somewhat related minor bug/difference in Libsass and Ruby Sass is the output of the following test:
Ruby Sass:
Libsass:
I don't foresee any issues arising from this bug in particular, however it is an interesting difference to note. |
Okay, this should be fixed now. Please give it a try. |
In my Scss file I have this line:
@import url(http://fonts.googleapis.com/css?family=Titillium+Web:400,300,200,600);
Actual Results:
When the file is compiled with libsass, the @import line is completely obliterated and does not appear in the output file.
Expected Results:
The @import line should be copied, verbatim, to the final CSS file because it does not target a local file. It needs to appear in the CSS file so that my font is loaded correctly.
Ruby Sass behaves correctly. It moves the @import statement, verbatim, to the compiled CSS file.
Technical Note:
In fixing this, it is not sufficient to test for the presence of
http://
. Many times, folks will use a protocol-less URL so that the import will work on both HTTP and HTTPS pages. An example of this would be:The double slashes leading the statement need to be treated as a URL to a remote resource on the internet and, therefore, this @import statement needs to be placed, verbatim, in the compiled CSS file.
The text was updated successfully, but these errors were encountered: