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

lessVarsFilePath doesn't work #74

Closed
Webbrother opened this issue Aug 19, 2021 · 6 comments
Closed

lessVarsFilePath doesn't work #74

Webbrother opened this issue Aug 19, 2021 · 6 comments

Comments

@Webbrother
Copy link

Webbrother commented Aug 19, 2021

Issue

I'm trying to use next-plugin-antd-less according to the documentation, but my antd variables don't work.

I'm trying to use lessVarsFilePath property (everything according to the documentation), but it just doesn't work.

How to reproduce:

Please see this repo https://github.com/Webbrother/next-plugin-antd-less-issue

yarn
then
yarn dev

I have variable in vatiables.less:

@primary-color: #ff0000; // <- this is a red color

I expect to see the red (my custom override color) button on the page, but I see the default color (blue).

How can I fix it?

@viktor-mozdolevskyi
Copy link

viktor-mozdolevskyi commented Aug 19, 2021

Unfortunately, I have the same issue

@esanchezvz
Copy link

Having the same issue, what I did as a work around for the moment is created a js file exporting an object with the variables I want to override and importing it to next.config.js and setting the variables overrides in the modifyVars option just to keep the next.config.js file a little cleaner

@SolidZORO
Copy link
Owner

SolidZORO commented Aug 20, 2021

@Webbrother

// src/styles/variables.less
@import '~antd/lib/style/themes/default.less';   // <------ add this

//@primary-color: red;
@primary-color: #ff0000; // change antd primary-color

seemore, #36

@makoncline
Copy link

Adding the import to the override file does not solve for me either.
Doing what @esanchezvz suggested does work, but not ideal.

@coolbeatz71
Copy link

coolbeatz71 commented Aug 29, 2021

Having the same issue, what I did as a workaround for the moment is created a js file exporting an object with the variables I want to override and importing it to next.config.js and setting the variables overrides in the modifyVars option just to keep the next.config.js file a little cleaner

This solution is good. But not ideal for complex cases like reusing antd default variables. for example:

@text-color: fade(@black, 65%);

@sam-ac-dixon
Copy link

@Webbrother

// src/styles/variables.less
@import '~antd/lib/style/themes/default.less';   // <------ add this

//@primary-color: red;
@primary-color: #ff0000; // change antd primary-color

seemore, #36

This fixed it for me.

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

7 participants