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() {
[...]
}
Leave a Reply