You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Still trying to understand why I need this package? Please, help!
The text was updated successfully, but these errors were encountered:
saileshkotha
changed the title
Do we really need this package if we use create-react-app and react-app-rewired? (Trying to understand)
Do we really need this package if we use create-react-app and react-app-rewired? (Trying to understand) (Working code below)
Jun 29, 2020
It's not going to work if you're trying to change a property with a variable that hasn't been defined in your antdCustom.scss file.
For example, if you didn't define @highlight-color in your file and you're trying to set '@label-required-color': '@highlight-color'; (even though it's defined in 'antd/dist/antd.less'), it's going to throw an error.
The only way to to deal with the issue (and I've tried around 7-8 different approaches, including scss-to-json, less-to-json, this plugin and so on), is to write your styles in js file like so:
consttheme=require('../common/assets/styles/theme')const{
...,// your configsaddLessLoader,}=require('customize-cra')module.exports=override(
...,// your configsaddLessLoader({lessOptions: {javascriptEnabled: true,modifyVars: theme,},}),
Unfortunately, with this approach (and others I've tried), you can forget about hot reloading when you change theme variables. Other than that, everything works as expected - your variables override the default ones, and the derivative variable are calculated based on your vars (meaning, you don't need to provide values for them, i.e, no need for '@primary-5': '#fff').
My current project is currently in Ant.d, Less, Create-react-app and uses react-app-rewired, customize-cra for custom webpack configurations.
Current config-override.js looks like this, and it works perfectly. Please tell me why I need this package?
Still trying to understand why I need this package? Please, help!
The text was updated successfully, but these errors were encountered: