Gathering detailed insights and metrics for less-plugin-remove-antd-global-styles-fix
Gathering detailed insights and metrics for less-plugin-remove-antd-global-styles-fix
Gathering detailed insights and metrics for less-plugin-remove-antd-global-styles-fix
Gathering detailed insights and metrics for less-plugin-remove-antd-global-styles-fix
npm install less-plugin-remove-antd-global-styles-fix
Typescript
Module System
Node Version
NPM Version
70.4
Supply Chain
98.8
Quality
75.1
Maintenance
100
Vulnerability
100
License
Total Downloads
417
Last Day
2
Last Week
5
Last Month
14
Last Year
192
Minified
Minified + Gzipped
Latest Version
1.0.4
Package Id
less-plugin-remove-antd-global-styles-fix@1.0.4
Unpacked Size
20.71 kB
Size
6.74 kB
File Count
13
NPM Version
9.4.0
Node Version
19.6.0
Publised On
31 May 2023
Cumulative downloads
Total Downloads
Last day
-33.3%
2
Compared to previous day
Last week
-16.7%
5
Compared to previous week
Last month
16.7%
14
Compared to previous month
Last year
-14.7%
192
Compared to previous year
4
fork from less-plugin-remove-antd-global-styles
This is a less plugin that removes ant-design global styles.
It works well with vite, webpack, rollup and babel-plugin-import.
Solve https://github.com/ant-design/ant-design/issues/9363 .
It works by mapping the global.less into an empty file: https://github.com/csr632/less-plugin-remove-antd-global-styles/blob/main/src/index.ts
npm i -D less-plugin-remove-antd-global-styles
If you are using vite, pass it to vite config:
1// vite.config.ts 2import { LessPluginRemoveAntdGlobalStyles } from 'less-plugin-remove-antd-global-styles' 3 4export default { 5 // ... 6 css: { 7 preprocessorOptions: { 8 less: { 9 // put less plugin here 10 plugins: [new LessPluginRemoveAntdGlobalStyles()], 11 }, 12 }, 13 }, 14}
If you are using webpack, pass it to less-loader options:
1// webpack.config.js 2const { LessPluginRemoveAntdGlobalStyles } = require('less-plugin-remove-antd-global-styles'); 3 4module.exports = { 5 ... 6 { 7 loader: 'less-loader', 8 options: { 9 lessOptions: { 10 plugins: [ 11 new LessPluginRemoveAntdGlobalStyles(), 12 ], 13 javascriptEnabled: true, 14 }, 15 }, 16 }, 17 ... 18};
Stackblitz demo: https://stackblitz.com/edit/webpack-5-react-starter-exaaw5?file=webpack.config.js
If you are using rollup, pass it to rollup-plugin-postcss:
1// rollup.config.js 2import { LessPluginRemoveAntdGlobalStyles } from 'less-plugin-remove-antd-global-styles' 3 4export default { 5 plugins: [ 6 postcss({ 7 use: { 8 less: { 9 plugins: [new LessPluginRemoveAntdGlobalStyles()], 10 }, 11 }, 12 }), 13 ], 14}
If you are using babel-plugin-import to do import-on-demand, you should pass style: true
to the babel plugin (so that it will import .less
files instead of .css
files). Here is a babel.config.json
example:
1{ 2 "plugins": [ 3 [ 4 "babel-plugin-import", 5 { 6 "libraryName": "antd", 7 "style": true 8 } 9 ] 10 ] 11}
You may want to add some reasonable global styles to your own stylesheet after removing global styles from antd. For example, you probably want to keep these styles:
1/* your-own-global-style.less */ 2 3/* 4pick some reasonable global styles from 5https://github.com/ant-design/ant-design/blob/master/components/style/core/global.less 6*/ 7 8*, 9*::before, 10*::after { 11 box-sizing: border-box; 12} 13 14/* you can make reset styles only take effect within antd elements */ 15*[class*='ant-'] { 16 a { 17 text-decoration: none; 18 } 19}
No vulnerabilities found.
No security vulnerabilities found.