mhulse / rex

On, Wildfire, on!
http://mhulse.github.io/rex/demo/
Apache License 2.0
4 stars 0 forks source link

Make baseline an @import css part #108

Closed mhulse closed 11 years ago

mhulse commented 11 years ago

_baseline.scss, so it can be used all by its lonesome in other projects.

mhulse commented 11 years ago

Looks like SASS doesn't allow for @imports to be used inside an @if .... When I try, I get:

./files/styles/_master.scss:109: Import directives may not be used within control directives or mixins. (Sass::SyntaxError)

Possible solution is to use a mixin, like:

@import in @if statement in SASS

Here's the Official reasoning for this limitation:

It was never intended that @import would work in a conditional context, this makes it impossible for us to build a dependency tree for recompilation without fully executing the file -- which would be simply terrible for performance.

Going to shelve this issue for now; I'll re-open/create new issue if/when it's needed in future.

mhulse commented 11 years ago

I ended up making the baseline class a mixin, used like so:

@if $flag_baseline {

    .#{$NS}baseline {

        @include baseline-grid;

    }

}