Skip to content

Commit 8a17b1d

Browse files
committed
feat: add rename css feature
This commit introduces a change in the way CSS selectors are extracted. Previously, only the keys of the query object were used as filters. Now, both keys and values are used, allowing for more precise CSS extraction. The values in the query object can now be used to replace the selected CSS, providing more flexibility and control over the CSS extraction process.
1 parent 2d5b51d commit 8a17b1d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

mod.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,16 @@ export function importCSSPreprocess(): PreprocessorGroup {
118118
let replaceText: string | undefined = undefined;
119119

120120
if (Object.keys(query).length > 0) {
121+
const filters = Object.entries(query).map(([key, value]) => ({
122+
selector: key,
123+
replacement: value ?? undefined,
124+
}));
125+
121126
const selectedCss: string = await cssSelectorExtract.process({
122127
css: cssText,
123-
filters: Object.keys(query),
128+
filters,
124129
});
130+
125131
replaceText = selectedCss;
126132
} else {
127133
replaceText = cssText;

0 commit comments

Comments
 (0)