Skip to content

Allow specifying replacements as a callback #70

Open
@joepie91

Description

@joepie91

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, ".");
	}
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions