This commit is contained in:
Phoenix 2024-02-02 10:18:04 +08:00
parent 69f0e265a6
commit 8e4713512a

View File

@ -1,16 +0,0 @@
// 使用 ES6 模块导入
import postcss from 'postcss';
// 创建并导出插件
export const customPostCSSPlugin = postcss.plugin('custom-postcss-plugin', (options) => {
return (root, result) => {
const file = result.opts.from; // 获取正在处理的文件的路径
// 判断是否是目标文件
if (file && file.includes(options.filename)) {
// 执行特定的 PostCSS 操作
root.walkRules((rule) => {
rule.selectors = rule.selectors.map(selector => `.special-scope ${selector}`);
});
}
};
});