vue-code-transformer
Version:
Codemod tool for Vue projects, built using jscodeshift, postcss, and vue-eslint-parser
27 lines (24 loc) • 706 B
JavaScript
/**
* This replaces every declaration value to 'red'.
*/
import scss from "postcss-scss";
import { defineTransformation } from "vue-code-transformer";
export default defineTransformation({
ruleName: "change-css-declaration-migration",
type: "css",
parser: scss,
transformAST: ({ source, path }, options) => {
const plugin = (opts = {}) => {
return {
postcssPlugin: "change-css-declaration",
Declaration (decl) {
if (decl.value === "black") {
decl.value = "red"
}
}
};
};
plugin.postcss = true;
return plugin;
}
})