Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
react-app-rewire-antd-theme
Advanced tools
This package is to setup Ant Design custom and live/dynamic theme with React App(create-react-app)
This package is mainly to generate a color.less
file which can be used to update color specific theme variables
at runtime in browser or one can apply theme based on saved color configurations.
But this package can be used just to setup Ant Design (antd) with create-react-app
project.
You simply need to install this package and add a config-overrides.js
file in project's root directory.
Live Theme Demo: https://mzohaibqc.github.io/antd-live-theme/
Add following code in above file
const path = require('path');
const { updateConfig } = require('react-app-rewire-antd-theme');
const options = {
stylesDir: path.join(__dirname, './src/styles'),
antDir: path.join(__dirname, './node_modules/antd'),
varFile: path.join(__dirname, './src/styles/variables.less'),
mainLessFile: path.join(__dirname, './src/styles/index.less'),
themeVariables: ['@primary-color'],
indexFileName: 'index.html'
}
module.exports = function override(config, env) {
config = updateConfig(config, env, options)
return config;
};
Default paths for various files are as in above code snippet but you can override by passing your own values.
themeVariables
is required field (if you want to generate color.less file for Dynamic theme) and it's an array of color variable names that you want to configure for Dynamic theme e.g. ['@primary-color', '@secondry-color']
Here are two color specified in array. First one is Ant Design specific and other is our custom one. You can use only Ant Design color variables or just only your own or both as you can see in example.
In order to just integrate Ant Design with react project, just provide varFile
path or vars
object.
const path = require('path');
const { updateConfig } = require('react-app-rewire-antd-theme');
const options = {
varFile: path.join(__dirname, './src/styles/variables.less')
}
// Or
// const options = {
// vars: {
// '@primary-color': '#ff0000'
// }
// }
module.exports = function override(config, env) {
config = updateConfig(config, env, options)
return config;
};
This function reads a less file and create an object with keys as variable names and values as variables respective values. e.g. variabables.less
@primary-color : #1890ff;
@heading-color : #fa8c16;
@text-color : #cccccc;
to
{
'@primary-color' : '#1890ff',
'@heading-color' : '#fa8c16',
'@text-color' : '#cccccc'
}
This method takes color string as input and return true if string is a valid color otherwise returns false with one exception that if a color matches this regex /colorPalette|fade/g
it will return true e.g.
isValidColor('#ffffff'); //true
isValidColor('#fff'); //true
isValidColor('rgba(0, 0, 0, 0.5)'); //true
isValidColor('20px'); //false
FAQs
This package is to setup Ant Design custom and live/dynamic theme with React App(create-react-app)
The npm package react-app-rewire-antd-theme receives a total of 72 weekly downloads. As such, react-app-rewire-antd-theme popularity was classified as not popular.
We found that react-app-rewire-antd-theme demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.