Eric Harms
Eric Harms

Reputation: 569

Can imports point to a variable

Is there a way to point the imports parameter to a variable?

@import $variable_name

Upvotes: 1

Views: 75

Answers (1)

Pigueiras
Pigueiras

Reputation: 19356

This is what the documentation says:

Imports may contain #{} interpolation, but only with certain restrictions. It’s not possible to dynamically import a Sass file based on a variable; interpolation is only for CSS imports. As such, it only works with url() imports. For example:

$family: unquote("Droid+Sans");
@import url("http://fonts.googleapis.com/css?family=#{$family}");

would compile to

@import url("http://fonts.googleapis.com/css?family=Droid+Sans");

So probably, the answer to your question will be that what you are trying to do, it's not possible.

Upvotes: 3

Related Questions