Skip to content

Commit

Permalink
WC: User defined variables will override default variables and will b…
Browse files Browse the repository at this point in the history
…e applied
  • Loading branch information
mzohaibqc committed May 14, 2020
1 parent ae1ec64 commit 0f64132
Show file tree
Hide file tree
Showing 12 changed files with 3,103 additions and 3,065 deletions.
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}\\index.js"
}
]
}
13 changes: 3 additions & 10 deletions examples/customize-cra/color.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ const path = require('path');
const fs = require('fs');
const { generateTheme, getLessVars } = require('../../index');

const themeVariables = getLessVars(path.join(__dirname, './src/styles/vars.less'))
const defaultVars = getLessVars('./node_modules/antd/lib/style/themes/default.less')
const darkVars = { ...getLessVars('./node_modules/antd/lib/style/themes/dark.less'), '@primary-color': defaultVars['@primary-color'] };
const lightVars = { ...getLessVars('./node_modules/antd/lib/style/themes/compact.less'), '@primary-color': defaultVars['@primary-color'] };
fs.writeFileSync('./src/dark.json', JSON.stringify(darkVars));
fs.writeFileSync('./src/light.json', JSON.stringify(lightVars));
fs.writeFileSync('./src/theme.json', JSON.stringify(themeVariables));


const options = {
Expand All @@ -15,16 +17,7 @@ const options = {
varFile: path.join(__dirname, './src/styles/vars.less'),
mainLessFile: path.join(__dirname, './src/styles/main.less'),
themeVariables: Array.from(new Set([
'@primary-color',
'@secondary-color',
'@text-color',
'@text-color-secondary',
// '@heading-color',
// '@layout-body-background',
// '@btn-primary-bg',
// '@layout-header-background',
// '@border-color-base',
// '@white',
...Object.keys(themeVariables),
...Object.keys(darkVars),
...Object.keys(lightVars)
])),
Expand Down
1 change: 1 addition & 0 deletions examples/customize-cra/mappings.json

Large diffs are not rendered by default.

Loading

0 comments on commit 0f64132

Please sign in to comment.