Currently, replaceSymbols only accepts a mapping of values. This is problematic because the same value may need to be represented differently in different contexts (reference, and there's no way to do that right now.
An API that would solve this, would be something like:
icssUtils.replaceSymbols(css, (symbol, context) => {
let mappedSymbol = someMapping[symbol];
if (context === "decl") {
return mappedSymbol;
} else {
return mappedSymbol.replace(/ /g, ".");
}
});
Currently,
replaceSymbolsonly accepts a mapping of values. This is problematic because the same value may need to be represented differently in different contexts (reference, and there's no way to do that right now.An API that would solve this, would be something like: