Skip to content
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

Error Variable @black is undefined when using with craco-antd #38

Open
Janaka-Steph opened this issue Oct 20, 2021 · 0 comments
Open

Error Variable @black is undefined when using with craco-antd #38

Janaka-Steph opened this issue Oct 20, 2021 · 0 comments

Comments

@Janaka-Steph
Copy link

Janaka-Steph commented Oct 20, 2021

I got an error Variable @black is undefined when using with craco-antd in create-react-app project.

craco.config.js

module.exports = {
  plugins: [
    {
      plugin: CracoAntDesignPlugin,
      options: {
        customizeThemeLessPath: path.join(__dirname, 'src/assets/styles/antd.customize.less'),
      },
    },
  ],
}

antd.customize.less

@import '~antd/lib/style/themes/default.less';

@body-background: @black;
@component-background: #141414;
@icon-color-hover: fade(@white, 75%);
...

I would expect that Less variables values like @black to be resolved using the import of default.less and suscequent imports in that file. But this is not the case. It seems that @black is simply treated as a string value.

Is there a way to resolve those variables before sending it to modifyVars ?
If it's not possible, it would be nice to have antd-theme to output the theme with all values resolved to css, #000 instead of @black, etc.

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant