I am trying to create a function to switch themes. When I transpile my Less to CSS, the CSS file shows the literal string interpolation rather than the variable value. The variables file looks something like:
@beach-font-color: #3d3d3d;
@ocean-font-color: #d3d3d3;
@theme: "beach";
@symbol: "@";
@currentTheme-font-color: ~"@{symbol}@{theme}-font-color";
In the stylesheet:
body { color: @currentTheme-font-color; }
The generated css produces:
body { color: @beach-font-color; }
instead of:
body { color: #3d3d3d; }
One thing I thought might be required is:
@font: ~"@{symbol}@{theme}-font-color";
@currentTheme-font-color: ~"@{font}";
But this just produces the same results.
Why does the Less compiler use the string literal instead of the variable value?
How would I be able to get the value of the variable, going along these lines?