{"name":"purgecss-webpack-plugin","version":"2.0.5","description":"PurgeCSS plugin for webpack - Remove unused css","author":{"name":"Ffloriel","email":"florielfedry@gmail.com"},"homepage":"https://purgecss.com","keywords":["webpack-plugin","optimize","optimization","remove","unused","css","html","rules","purge","uncss","purify"],"license":"MIT","main":"lib/purgecss-webpack-plugin.js","module":"./lib/purgecss-webpack-plugin.esm.js","types":"./lib/purgecss-webpack-plugin.d.ts","directories":{"lib":"lib","test":"__tests__"},"repository":{"type":"git","url":"git+https://github.com/FullHuman/purgecss.git"},"scripts":{"test":"echo \"Error: run tests from root\" && exit 1"},"dependencies":{"purgecss":"^2.0.5","webpack":"^4.41.2","webpack-sources":"^1.4.3"},"bugs":{"url":"https://github.com/FullHuman/purgecss/issues"},"devDependencies":{"@types/webpack":"^4.39.7","@types/webpack-sources":"^0.1.5","css-loader":"^3.2.0","mini-css-extract-plugin":"^0.9.0"},"peerDependencies":{"webpack":"*"},"gitHead":"a1176c1e2b83e80324e1a2cc75c88d1b795d863a","_id":"purgecss-webpack-plugin@2.0.5","_nodeVersion":"13.2.0","_npmVersion":"lerna/3.20.2/node@v13.2.0+x64 (darwin)","dist":{"integrity":"sha512-k7NT6FZ/ChzcOZTWtUyqAW+E29n7QEO87WWfwKDF8bjvMXsH5TqK5RvEragDQKT16RaxYCvXZkQ2chvnfFXPIg==","shasum":"6ccd0be4db2011535dfd2f1d56e3d5c6637e2433","tarball":"http://registry-npm.ywwl.com/purgecss-webpack-plugin/download/purgecss-webpack-plugin-2.0.5.tgz","fileCount":7,"unpackedSize":16830,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeJkIRCRA9TVsSAnZWagAA+ZcP/iCH2q8mfT7pm+FYu0kB\nhpT7jTvopcbolffnBsO01QItt9b7U1X22LP/XnxDpRDDAFLIufa5dAhtAHHK\n/sg8WcHamQErIRJnK9ldxF7flrQOyEDIRl+FulNK1NTqM1iXH7+kF4H9P241\nRY4GVOjVgcx14V8M0XXP17+OjydVFMX18W9fKRknEbfPVlAaCTRSwGeInRGZ\n0t14bxwvwxuLUSvXfytIAl7AFQszn1bqHhp2Nt4bnLL6WYYTg9gMB+irFddh\n6B7Gx77tJ2offonEf5IezV2o98528xXEl30GWn6PvsWgwN117/Hze5i/KDj2\nhnb4hHTa02hWdmjd/lcKwU1jwPvhd+wOy6tumswqeYPprjNSMu5CJ0n5BQZB\n59TbNm3JWAhsSmZCyEQosjTXRo0kUoA6X6x2ddVqJw8dif6FQcxAb8eizN5t\nBnXrKSESCK8E4sqLiTZNBvJv245HzyQc97CrBenGmBX55raUF4gvoI7Az2X9\nby46Sw9+EV5NeRl5il67elHhP1/A8dtPj8Ipz2bNfNxDgHSWukJL+q+uUY/w\nabH4Br5jdZiiWKUN2TfIZYFTvoOC1f6n1AIIHH+mquzpidO3JXm/CMnfc7LM\nqGsJqusYjAWzmzPtqqWtIXsy+zF0qNqw2loV1AtsLen9N9PxsQSL+m4MX1o7\n4VyS\r\n=b35/\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCaIuvNJFOsq6dDRAlpBFgWHNLaet+vISeYz25fjnbmQAIgP87NlV3ewv0HnNtKu+8Cjw+Yhf8XvAkMSxIOBF0z2Vw="}],"size":5205,"noattachment":false,"key":"/purgecss-webpack-plugin/-/purgecss-webpack-plugin-2.0.5.tgz"},"maintainers":[{"email":"ffloriel.dev@gmail.com","name":"ffloriel"},{"email":"megamaaaan@gmail.com","name":"jsnanigans"}],"_npmUser":{"name":"ffloriel","email":"ffloriel.dev@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/purgecss-webpack-plugin_2.0.5_1579565584978_0.14838695682269298"},"_hasShrinkwrap":false,"readme":"# purgecss-webpack-plugin\n\n[![npm](https://img.shields.io/npm/v/purgecss-webpack-plugin.svg)](https://www.npmjs.com/package/purgecss-webpack-plugin)\n[![license](https://img.shields.io/github/license/fullhuman/purgecss-webpack-plugin.svg)]()\n\n[Webpack](https://github.com/webpack/webpack) plugin to remove unused css.\n\n## Install\n\n```sh\nnpm i purgecss-webpack-plugin -D\n```\n\n## Usage\n\n### With mini-css-extract-plugin\n\n```js\nconst path = require(\"path\");\nconst glob = require(\"glob\");\nconst MiniCssExtractPlugin = require(\"mini-css-extract-plugin\");\nconst { PurgeCSSPlugin } = require(\"purgecss-webpack-plugin\");\n\nconst PATHS = {\n  src: path.join(__dirname, \"src\"),\n};\n\nmodule.exports = {\n  entry: \"./src/index.js\",\n  output: {\n    filename: \"bundle.js\",\n    path: path.join(__dirname, \"dist\"),\n  },\n  optimization: {\n    splitChunks: {\n      cacheGroups: {\n        styles: {\n          name: \"styles\",\n          test: /\\.css$/,\n          chunks: \"all\",\n          enforce: true,\n        },\n      },\n    },\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.css$/,\n        use: [MiniCssExtractPlugin.loader, \"css-loader\"],\n      },\n    ],\n  },\n  plugins: [\n    new MiniCssExtractPlugin({\n      filename: \"[name].css\",\n    }),\n    new PurgeCSSPlugin({\n      paths: glob.sync(`${PATHS.src}/**/*`, { nodir: true }),\n    }),\n  ],\n};\n```\n\n### Multiple paths\n\nIf you need multiple paths use the npm package `glob-all` instead of `glob`, then you can use this syntax:\n\n```javascript\nnew PurgeCSSPlugin({\n  paths: glob.sync([\n    // ...\n  ])\n}),\n```\n\nto filter out directories see the glob-all documentation [here](https://www.npmjs.com/package/glob-all#filtering-out-directories).\n\n### Options\n\nThe options available in purgecss [Configuration](https://www.purgecss.com/configuration.html) are also available in the webpack plugin with the exception of css and content.\n\n- #### paths\n\nWith the webpack plugin, you can specify the content that should be analyzed by purgecss with an array of filename. It can be html, pug, blade, ... files. You can use a module like `glob` or `glob-all` to easily get a list of files.\n\n```js\nconst { PurgeCSSPlugin } = require(\"purgecss-webpack-plugin\");\nconst glob = require(\"glob\");\nconst PATHS = {\n  src: path.join(__dirname, \"src\"),\n};\n\n// In the webpack configuration\nnew PurgeCSSPlugin({\n  paths: glob.sync(`${PATHS.src}/**/*`, { nodir: true }),\n});\n```\n\nIf you want to regenerate the paths list on every compilation (e.g. with `--watch`), then you can also pass a function:\n\n```js\nnew PurgeCSSPlugin({\n  paths: () => glob.sync(`${PATHS.src}/**/*`, { nodir: true }),\n});\n```\n\n- #### only\n\nYou can specify entrypoints to the purgecss-webpack-plugin with the option only:\n\n```js\nnew PurgeCSSPlugin({\n  paths: glob.sync(`${PATHS.src}/**/*`, { nodir: true }),\n  only: [\"bundle\", \"vendor\"],\n});\n```\n\n- #### safelist\n\nSimilar as for the `paths` option, you also can define a function for this option:\n\n```js\nfunction collectSafelist() {\n  return {\n    standard: [\"safelisted\", /^safelisted-/],\n    deep: [/^safelisted-deep-/],\n    greedy: [/^safelisted-greedy/],\n  };\n}\n\n// In the webpack configuration\nnew PurgeCSSPlugin({\n  safelist: collectSafelist,\n});\n```\n\n- #### rejected\n\nIf `true` all removed selectors are added to the [Stats Data](https://webpack.js.org/api/stats/) as `purged`.\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](./../../CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](./../../LICENSE) file for details\n","publish_time":1579565585139,"_cnpm_publish_time":1579565585139,"dist-tags":{"latest":"8.0.0","next":"3.1.3-alpha.0"}}