-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add example of working with AntdScssThemePlugin #25
Comments
It took a while to work it all out, but this craco.config.js file will do it:
Note that one odd consequence of this is that there are now two ways to override Ant's variables: through a custom less file or a custom sass file. The less version is still the more powerful of the two because it can make use of Ant's variables. The custom sass file, in contrast, can only override Ant variables -- it can't reference them. But, other sass files can reference Ant's variables now, so that's really nice. |
@nirvdrum I'm getting a sass export error with this.
Did you get anything similar? I have a theme file in |
Did you ever resolve this issue? |
getting same error, any solution? |
++++ 1 same error... I like antd & scss! I want define my variables from single file this is my current craco.config.js const CracoAntDesignPlugin = require("craco-antd");
const path = require("path");
const pathResolve = (pathUrl) => path.join(__dirname, pathUrl);
module.exports = {
reactScriptsVersion: "react-scripts",
plugins: [
{
plugin: CracoAntDesignPlugin,
options: {
customizeThemeLessPath: pathResolve("src/styles/variables.antd.less"),
},
},
],
}; |
craco-antd is a great way to provide a custom theme for Ant with a project created by create-react-app. I think the next logical step for many projects is being able to consume the Ant less styles from within an SCSS-enabled CRA-based app. AntdScssThemePlugin is a project that enables doing such, by hooking into the less and sass loaders.
Since craco-antd also pulls in craco-less, it has all the key components to support AntdScssThemePlugin. I think it'd be helpful if the documentation showed how to do so.
I realize docs like this may not be an exact fit because it includes an external project. However, I think it's in keeping with the goals of this project and that documentation should live somewhere semi-official, instead of someone's blog.
The text was updated successfully, but these errors were encountered: