dilanx / craco

Create React App Configuration Override, an easy and comprehensible configuration layer for Create React App.
https://craco.js.org
Apache License 2.0
7.43k stars 499 forks source link

Exclude a path from applying postcss rules on it #402

Closed arianshahalami closed 2 years ago

arianshahalami commented 2 years ago

Problem

Not able to apply postcss on a specific path

Description

Im using React and craco@v6.alpha. in postcssOptions I use postcss-rtlcss plugin which makes styles rtl. I'm using a template which I dont want to to apply postcss-rtlcss on it. but I couldn't find a way to exclude a path in postcss, craco or postcss-rtlcss configs. any idea?

My craco config

const postCssRtl = require("postcss-rtlcss");

module.exports = {
    reactScriptsVersion: "react-scripts",
    style: {
        postcss: {
            loaderOptions: {
                postcssOptions: { 
                    plugins: [postCssRtl()],
                },
            },
        },
    },
};
dilanx commented 2 years ago

Try using postcss-exclude-files to get this behavior. You can configure webpack within your craco config. I'll close this issue but feel free to leave a comment if you're still having this problem.