Getting module from string parameter

Viewed 16

I'm trying to get a module name from a string. Here is an example of what I imagine it would look like:

@use 'dark'; /* _dark.scss, with a $color variable */
@use 'light'; /* _light.scss, with a $color variable */

@mixin theme($name) {
  body {
    color: #{$name}.$color;
  }
}

If I passed in "dark" as an argument, I would want this result:

...
color: dark.$color;
...

If I passed in "light" as an argument, I would want this result:

...
color: light.$color;
...
0 Answers
Related