Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Import Google font doesn't follow structure #843

Closed
rajibmp opened this Issue · 3 comments

3 participants

@rajibmp

I imported few fonts from Google API, and the Import line goes top of the page. No matter where I put the import function in scss file, the output goes at top of css(compiled) page.

To give clear view of the issue, my scss file is here where I import the code:
https://github.com/rajibmp/mak/blob/master/sass/_fonts.scss

This is the output page after compiling scss:
https://github.com/rajibmp/mak/blob/master/css/style.css

@chriseppstein

The CSS import directive is required to be at the top of a CSS file. This is Sass saving you from yourself :four_leaf_clover:

From the spec:

In CSS 2.1, any @import rules must precede all other rules (except the @charset rule, if present).

@cimmanon

Look a little closer. Yes, @import must must precede all other rules. The OP didn't make it clear, but the problem is that they want to have the comments appear with the import.

What they want:

/* comment here about the file that's being imported */
@import url('somefile.css');

What they're getting:

@import url('somefile.css');
/* comment here about the file that's being imported */

Comments are allowed to precede imports.

@chriseppstein

I see. Good catch.

I guess we could only move the import node if we detect it was in an illegal place.

Associating comments to selectors and directives is a tricky concept. It's not obvious that a comment is always documenting the thing below it. Sometimes it is a piece of code that is disabled, etc.

@chriseppstein chriseppstein reopened this
@nex3 nex3 closed this in 18ed5bc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.