{"id":18122949,"url":"https://github.com/americanexpress/purgecss-loader","last_synced_at":"2025-04-14T22:52:19.693Z","repository":{"id":38173201,"uuid":"132161348","full_name":"americanexpress/purgecss-loader","owner":"americanexpress","description":"✨ A Webpack loader to strip unused selectors from your CSS","archived":true,"fork":false,"pushed_at":"2024-05-29T15:25:52.000Z","size":1208,"stargazers_count":22,"open_issues_count":0,"forks_count":4,"subscribers_count":19,"default_branch":"main","last_synced_at":"2025-04-14T22:52:07.837Z","etag":null,"topics":["css","css-modules","one-app","optimization","purgecss","strip-unused-selectors","webpack-loader"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/americanexpress.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-04T16:02:04.000Z","updated_at":"2024-05-29T16:49:36.000Z","dependencies_parsed_at":"2024-05-29T18:04:09.936Z","dependency_job_id":null,"html_url":"https://github.com/americanexpress/purgecss-loader","commit_stats":{"total_commits":53,"total_committers":13,"mean_commits":4.076923076923077,"dds":0.5471698113207547,"last_synced_commit":"e3c23f86d0145c6fdf70942b11bd4aa09a342c32"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/americanexpress%2Fpurgecss-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/americanexpress%2Fpurgecss-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/americanexpress%2Fpurgecss-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/americanexpress%2Fpurgecss-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/americanexpress","download_url":"https://codeload.github.com/americanexpress/purgecss-loader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975309,"owners_count":21192202,"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":["css","css-modules","one-app","optimization","purgecss","strip-unused-selectors","webpack-loader"],"created_at":"2024-11-01T07:07:14.939Z","updated_at":"2025-04-14T22:52:19.676Z","avatar_url":"https://github.com/americanexpress.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n\n  [One App is now InnerSource](https://github.com/americanexpress/one-app/issues/1393)\n\n  \u003chr/\u003e\n\n  \u003cimg src='https://github.com/americanexpress/purgecss-loader/raw/main/purgecss-loader.png' alt=\"purgecss-loader - One Amex\" width='50%'/\u003e\n\u003c/h1\u003e\n\n[![npm version](https://badge.fury.io/js/%40americanexpress%2Fpurgecss-loader.svg)](https://badge.fury.io/js/%40americanexpress%2Fpurgecss-loader)\n\n\u003e This [Webpack](https://github.com/webpack/webpack) loader uses [purgecss](https://github.com/FullHuman/purgecss)\nto strip unused selectors from your CSS.\n\n## 📖 Table of Contents\n\n* [Features](#-features)\n* [Usage](#-usage)\n* [API](#%EF%B8%8F-api)\n* [License](#%EF%B8%8F-license)\n* [Code Of Conduct](#%EF%B8%8F-code-of-conduct)\n* [Contributing](#-contributing)\n\n## ✨ Features\n\n* Ability to remove CSS modules\n* Ability to remove plain CSS declarations\n* Reduce bundle size\n\n## 🤹‍ Usage\n\n```\nnpm install -D @americanexpress/purgecss-loader\n```\n\n## 🎛️ API\n\n### Configure as follows:\n\n```js\nmodule.exports = {\n  entry: {...},\n  output: {...},\n  module: {\n    rules: [\n      {\n        test: /\\.css$/,\n        use: [\n          {\n            loader: 'css-loader',\n            options: {\n              modules: true,\n              localIdentName: '[name]__[local]___[hash:base64:5]',\n            },\n          },\n          {\n            loader: '@americanexpress/purgecss-loader',\n            options: {\n              paths: [path.join(somePath, 'src/**/*.{js,jsx}')],\n              safelist: [/:global$/],\n            },\n          },\n        ],\n      },\n    ],\n  },\n}\n```\n\nYou should use this with the [`css-loader`](https://github.com/webpack-contrib/css-loader)\nas seen above. However, it is not required that you use CSS modules. That is in\nthe example to express this loader's compatibility.\n\n### Options\n\n| Property        | Description                       | Required |\n|-----------------|-----------------------------------|----------|\n| `paths`         | An array of file [glob] patterns  | `true`   |\n| `extractors`    | An array of [purgecss extractors] | `false`  |\n| `fontFace`   | `boolean` (default: false) see [options]     | `false`  |\n| `keyframes`  | `boolean` (default: false) see [options] | `false`  |\n| `variables`  | `boolean` (default: false) see [options] | `false`  |\n| `safelist`  | `UserDefinedSafelist` see [options]| `false`  |\n| `blocklist` | `StringRegExpArray` see [options] | `false`  |\n\n[glob]: https://github.com/isaacs/node-glob\n[purgecss extractors]: https://www.purgecss.com/extractors.html\n[options]: https://purgecss.com/configuration.html#options\n\n## 🗝️ License\n\nAny contributions made under this project will be governed by the\n[Apache License 2.0](./LICENSE.txt).\n\n## 🗣️ Code of Conduct\n\nThis project adheres to the [American Express Community Guidelines](./CODE_OF_CONDUCT.md).\nBy participating, you are expected to honor these guidelines.\n\n## 🏆 Contributing\n\nWe welcome Your interest in the American Express Open Source Community on Github.\nAny Contributor to any Open Source Project managed by the American Express Open\nSource Community must accept and sign an Agreement indicating agreement to the\nterms below. Except for the rights granted in this Agreement to American Express\nand to recipients of software distributed by American Express, You reserve all\nright, title, and interest, if any, in and to Your Contributions. Please [fill\nout the Agreement](https://cla-assistant.io/americanexpress/purgecss-loader).\n\nPlease feel free to open pull requests and see [CONTRIBUTING.md](./CONTRIBUTING.md)\nfor commit formatting details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famericanexpress%2Fpurgecss-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famericanexpress%2Fpurgecss-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famericanexpress%2Fpurgecss-loader/lists"}