Skip to content

Latest commit

 

History

History

plugin-postcss

@putout/plugin-postcss NPM version

postcss plugin helps to migrate to latest postcss version according to migration guide.

Install

npm i @putout/plugin-postcss -D

Rules

{
    "rules": {
        "postcss/replace-loader-with-creator": "on"
    }
}

replace-loader-with-creator

❌ Example of incorrect code

module.exports = postcss.plugin('postcss-dark-theme-class', (opts = {}) => {
    checkOpts(opts);
    
    return (root, result) => {
        root.walkAtRules((atrule) => {});
    };
});

✅ Example of correct code

module.exports = (opts = {}) => {
    checkOpts(opts);
    
    return {
        postcssPlugin: 'postcss-dark-theme-class',
        Once(root) {
            root.walkAtRules((atrule) => {});
        },
    };
};

module.exports.postcss = true;

License

MIT