vite-plugin-css-svg-mask-image 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -76,14 +76,11 @@ export function svgMaskPlugin(options = {}) {
|
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
async transform(code, id) {
|
|
79
|
-
|
|
79
|
+
const idPath = id.replace(/\?.*$/, "");
|
|
80
|
+
if (!idPath.match(/\.(css|scss|sass)$/)) {
|
|
80
81
|
return null;
|
|
81
82
|
}
|
|
82
|
-
const
|
|
83
|
-
const ast = postcss.parse(code, {
|
|
84
|
-
from: id,
|
|
85
|
-
...(syntax && { parser: syntax }),
|
|
86
|
-
});
|
|
83
|
+
const ast = postcssScss.parse(code, { from: id });
|
|
87
84
|
let has_svg_functions = false;
|
|
88
85
|
ast.walkDecls("mask-image", (decl) => {
|
|
89
86
|
const value = decl.value.trim();
|
|
@@ -130,10 +127,11 @@ export function svgMaskPlugin(options = {}) {
|
|
|
130
127
|
if (!has_svg_functions) {
|
|
131
128
|
return null;
|
|
132
129
|
}
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
130
|
+
const result = await postcss().process(ast, {
|
|
131
|
+
from: id,
|
|
132
|
+
to: id,
|
|
133
|
+
stringifier: postcssScss,
|
|
134
|
+
});
|
|
137
135
|
processed_files.add(id);
|
|
138
136
|
return {
|
|
139
137
|
code: result.css,
|
package/package.json
CHANGED