Ant-design-mobile: [2.0]How to customize theme when used with create-react-app

Created on 25 Oct 2017  ·  8Comments  ·  Source: ant-design/ant-design-mobile

What problem does this feature solve?

I'm following the instructions in this section of 2.0 docs to use antd-mobile with create-react-app. But I can't figure out how theme customization will work with react-app-rewired. The doc doesn't seem to cover this.

What does the proposed API look like?

Any suggestion?

document

Most helpful comment

react-app-rewired not working with react-scripts 2.1.2
The readme steps for antd with create-reat-app is failing

All 8 comments

Thanks. That'll be of great help

How to edit Less variables in create-react-app?

I tried that the 'modifyVars' method that seems do not work in the Mobile version.

@silentcloud thank you for the reply.
I think I didn't describe my question clearly, sorry about that.

My issue is how to change the variables in default.less with the create-react-app project.
In the customize-theme link, only taught how to do it with webpack.
In the antd-mobile-samples link, only taught how to load less in create-react-app.

Thank you.

@max8hine If you use create-react-app with react-app-rewired, you can see https://github.com/ant-design/antd-mobile-samples/blob/master/create-react-app/config-overrides.js#L46, find the theme variables which you want to change in default.less, then add them in modifyVars and change the value

@silentcloud Thanks a million, I did not check the code in that project, that's my fault =)

react-app-rewired not working with react-scripts 2.1.2
The readme steps for antd with create-reat-app is failing

Was this page helpful?
0 / 5 - 0 ratings