0

I'd like to import a colour palette using SASS and @if statement.

My code :

@if $look == default and not $look-chart-color or $look-chart-color == default {
      @import 'default';
}

@if $look == espacefourn and not $look-chart-color or $look-chart-color == espacefourn {
  @import 'espacefourn';
}

@if $look == ria and not $look-chart-color or $look-chart-color == ria {
  @import 'ria';
}

Issue : Error: Import directives may not be used within control directives or mixins.

tonymx227
  • 5,293
  • 16
  • 48
  • 91
  • see: https://stackoverflow.com/questions/13879042/import-in-if-statement-in-sass also: https://github.com/sass/sass/issues/451 seems flakey tbh – Denis Tsoi Dec 07 '17 at 08:50
  • I already found that ! But they have no solutions on these talk... – tonymx227 Dec 07 '17 at 08:54
  • it's difficult mate - because, you're trying to define values before compile (while your output is always static) - i wonder if you can use imports via css-variables /shrug – Denis Tsoi Dec 07 '17 at 08:58

0 Answers0