[RFC] v5 less consume variables #38365
zombieJ
announced in
RFCs - archive
Replies: 3 comments 3 replies
-
import { defaultTheme } from '.......';
{
loader: "less-loader",
options: {
lessOptions: {
modifyVars: defaultTheme,
},
},
}, |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Beta Was this translation helpful? Give feedback.
1 reply
-
我在按照教程引入时报错了,你们为什么可以在webpack.config中使用import呢?我在package.json中添加type:module依然不行 |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
📋 RFC
Summary
Provide a guide for static covert and compatible package to handle convert.
Basic example
[None]
Motivation
v5 using CSS-in-JS which means static css framework like less can not consume the less variable by antd anymore. We should find a way to help user using variables in static framework.
Detailed
New to use
antd provide static function and seed token to generate related token with out React life cycle:
User can consume as less variable with
less-loader
:Compatible usage
User use compatible package to convert v5 variables to compatible variables:
Then user need to remove useless less import code:
-- @import (reference) '~antd/dist/antd.less';
For umi user, can use
umi-plugin-antd
which will generate a mock fileantd/dist/antd.less
as placeholder.Drawbacks
Not fully support with v4 usage.
Adoption strategy
Guid in doc but recommend CSS-in-JS solution first.
Beta Was this translation helpful? Give feedback.
All reactions