Currently I am using both Grunt tasks grunt-sass and grunt-contrib-sass to compile sass (strictly scss). The first one is faster than second one, but second one generating source maps that just works. Unfortunately grunt-sass source maps somehow doesn’t work properly and browsers can’t use them.

I got an error message today and I’d like to share simple solution to that. The scss code more or less looks like:

@include example() {
[...]
@import 'part1';
@import 'part2';
[...]
}

Above code is compiled fine using grunt-sass, but grunt-contrib-sass shows me the error import directives may not be used within control directives or mixins. To solve the problem all you need is to move @import 'part1'; and @import 'part2'; outside of @include example() {. So, finally it will look like:

@import 'part1';
@import 'part2';

@include example() {
[...]
}

Comments

You can leave a response, or trackback from your own site.

Before you add comment see for rules.

Leave a Reply

Your email address will not be published. Required fields are marked *

4y3x9r