Comments (2)
I'll take a look at this later.
This might be exactly what I need :-)
from antd-scss-theme-plugin.
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:
theme.js
module.exports = {
'@primary-color': '#252930',
'@dark-gray': '#a09fa0',
'@light-gray': '#f2f1f1'
}
And then in config-overrides.js
:
const theme = require('../common/assets/styles/theme')
const {
..., // your configs
addLessLoader,
} = require('customize-cra')
module.exports = override(
..., // your configs
addLessLoader({
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'
).
from antd-scss-theme-plugin.
Related Issues (20)
- Error: Cannot find module 'sass-loader/dist/importsToResolve' HOT 3
- scss extension changing css extension - webpack build
- Webpack 4 and less 3 issues
- Fails with antd v4.x
- This version has been deprecated
- Could not compile the SCSS theme file "../scss/app.scss" for the purpose of variable extraction HOT 1
- Major release checks
- Less variables not being imported HOT 2
- support sass-loader version 8 HOT 8
- Plz Fix Warnings
- plugin not compatible with ng-zorro-antd. HOT 1
- Compatibility issue with sass-loader, Error: Sass Loader has been initialised using an options object that does not match the API schema. - options has an unknown property 'importer'. HOT 5
- Maintenance? HOT 6
- theme.scss won't let me use @font-face HOT 3
- support less-loader 6 HOT 1
- use sass instead of node-sass ? HOT 2
- Plugin doesn't work with sass-loader v8 and above and less-loader v6 and above HOT 2
- Compile takes a long time
- When used this plugin with sass-loader (version ^10.0.2) and craco is giving Cannot find module 'sass-loader/dist/importsToResolve' when used in webpack config
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from antd-scss-theme-plugin.