{"id":15681458,"url":"https://github.com/csr632/less-plugin-remove-antd-global-styles","last_synced_at":"2025-05-07T12:13:13.832Z","repository":{"id":119608422,"uuid":"554340890","full_name":"csr632/less-plugin-remove-antd-global-styles","owner":"csr632","description":"A less plugin that removes ant-design global styles","archived":false,"fork":false,"pushed_at":"2022-10-28T15:01:43.000Z","size":13,"stargazers_count":18,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T12:13:07.710Z","etag":null,"topics":["antd","less-plugin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csr632.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-19T16:44:29.000Z","updated_at":"2025-03-24T07:37:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"592cacc3-683a-4515-bde3-7815d53e7b1f","html_url":"https://github.com/csr632/less-plugin-remove-antd-global-styles","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csr632%2Fless-plugin-remove-antd-global-styles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csr632%2Fless-plugin-remove-antd-global-styles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csr632%2Fless-plugin-remove-antd-global-styles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csr632%2Fless-plugin-remove-antd-global-styles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csr632","download_url":"https://codeload.github.com/csr632/less-plugin-remove-antd-global-styles/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252873889,"owners_count":21817715,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["antd","less-plugin"],"created_at":"2024-10-03T16:54:56.097Z","updated_at":"2025-05-07T12:13:13.803Z","avatar_url":"https://github.com/csr632.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# less-plugin-remove-antd-global-styles\n\nThis is a [less plugin](https://lesscss.org/tools/#plugins) that removes [ant-design global styles](https://github.com/ant-design/ant-design/blob/master/components/style/core/global.less).\n\nIt works well with vite, webpack, rollup and babel-plugin-import.\n\nSolve https://github.com/ant-design/ant-design/issues/9363 .\n\n## How it works\n\nIt works by mapping the [global.less](https://github.com/ant-design/ant-design/blob/master/components/style/core/global.less) into an empty file: https://github.com/csr632/less-plugin-remove-antd-global-styles/blob/main/src/index.ts\n\n## Usage\n\n```\nnpm i -D less-plugin-remove-antd-global-styles\n```\n\n### vite\n\nIf you are using vite, pass it to [vite config](https://vitejs.dev/config/shared-options.html#css-preprocessoroptions):\n\n```ts\n// vite.config.ts\nimport { LessPluginRemoveAntdGlobalStyles } from 'less-plugin-remove-antd-global-styles'\n\nexport default {\n  // ...\n  css: {\n    preprocessorOptions: {\n      less: {\n        // put less plugin here\n        plugins: [new LessPluginRemoveAntdGlobalStyles()],\n      },\n    },\n  },\n}\n```\n\n### webpack\n\nIf you are using webpack, pass it to [less-loader options](https://webpack.js.org/loaders/less-loader/#plugins):\n\n```js\n// webpack.config.js\nconst { LessPluginRemoveAntdGlobalStyles } = require('less-plugin-remove-antd-global-styles');\n\nmodule.exports = {\n  ...\n    {\n      loader: 'less-loader',\n      options: {\n        lessOptions: {\n          plugins: [\n            new LessPluginRemoveAntdGlobalStyles(),\n          ],\n          javascriptEnabled: true,\n        },\n      },\n    },\n  ...\n};\n```\n\nStackblitz demo: https://stackblitz.com/edit/webpack-5-react-starter-exaaw5?file=webpack.config.js\n\n### rollup\n\nIf you are using rollup, pass it to [rollup-plugin-postcss](https://www.npmjs.com/package/rollup-plugin-postcss):\n\n```js\n// rollup.config.js\nimport { LessPluginRemoveAntdGlobalStyles } from 'less-plugin-remove-antd-global-styles'\n\nexport default {\n  plugins: [\n    postcss({\n      use: {\n        less: {\n          plugins: [new LessPluginRemoveAntdGlobalStyles()],\n        },\n      },\n    }),\n  ],\n}\n```\n\n### babel-plugin-import\n\nIf you are using [babel-plugin-import](https://github.com/umijs/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:\n\n```json\n{\n  \"plugins\": [\n    [\n      \"babel-plugin-import\",\n      {\n        \"libraryName\": \"antd\",\n        \"style\": true\n      }\n    ]\n  ]\n}\n```\n\n## Tips\n\nYou 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:\n\n```less\n/* your-own-global-style.less  */\n\n/* \npick some reasonable global styles from\nhttps://github.com/ant-design/ant-design/blob/master/components/style/core/global.less\n*/\n\n*,\n*::before,\n*::after {\n  box-sizing: border-box;\n}\n\n/* you can make reset styles only take effect within antd elements */\n*[class*='ant-'] {\n  a {\n    text-decoration: none;\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsr632%2Fless-plugin-remove-antd-global-styles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsr632%2Fless-plugin-remove-antd-global-styles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsr632%2Fless-plugin-remove-antd-global-styles/lists"}