Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
craco-antd
Advanced tools
This is a craco plugin that makes it easy to use the Ant Design UI library with create-react-app v2. This includes:
babel-plugin-import
to only import the required CSS, instead of everythingFirst, follow the beginning of the Ant Design create-react-app
Documentation to set up your app with Ant Design.
(Stop before the "Advanced Guides" section, because this plugin handles all of that for you.)
Then, follow the craco
Installation Instructions to install the craco
package, create a craco.config.js
file, and modify the scripts in your package.json
.
Then install craco-antd
:
$ yarn add -D craco-antd
# Or
$ npm i --save-dev craco-antd
Here is a complete craco.config.js
configuration file that sets up Less compilation and babel-plugin-import
for create-react-app
:
const CracoAntDesignPlugin = require("craco-antd");
module.exports = {
plugins: [{ plugin: CracoAntDesignPlugin }]
};
Ant Design also allows you to customize the theme by modifying the Less variables.
View Ant Design's "Customize Theme" documentation
Customize the theme with the customizeTheme
option:
const CracoAntDesignPlugin = require("craco-antd");
module.exports = {
plugins: [
{
plugin: CracoAntDesignPlugin,
options: {
customizeTheme: {
"@primary-color": "#1DA57A",
"@link-color": "#1DA57A",
"@border-radius-base": "2px"
}
}
}
]
};
(
customizeTheme
is just a nicer name for themodifyVars
option inless-loader
.)
If you need to pass any additional options to
less-loader
, you can pass these in alessLoaderOptions
object.
That's it! Now you can customize the Ant Design theme, and you can also compile Less files in your own app.
If you need to configure anything else for the webpack build, take a look at the
Configuration Overview section in the craco
README. You can use CracoAntDesignPlugin
while making other changes to babel
and webpack
, etc.
FAQs
A craco plugin to use Ant Design with create-react-app
The npm package craco-antd receives a total of 3,879 weekly downloads. As such, craco-antd popularity was classified as popular.
We found that craco-antd demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.