{"id":15029590,"url":"https://github.com/nmfr/optimize-css-assets-webpack-plugin","last_synced_at":"2025-05-14T05:10:47.449Z","repository":{"id":3382129,"uuid":"49304920","full_name":"NMFR/optimize-css-assets-webpack-plugin","owner":"NMFR","description":"A Webpack plugin to optimize \\ minimize CSS assets.","archived":false,"fork":false,"pushed_at":"2022-12-07T17:53:46.000Z","size":1129,"stargazers_count":1147,"open_issues_count":41,"forks_count":58,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-12T21:46:59.631Z","etag":null,"topics":["css-assets","css-processor","minimisation","minimization","minimizes","webpack-plugin"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NMFR.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-09T00:52:16.000Z","updated_at":"2025-05-06T03:08:15.000Z","dependencies_parsed_at":"2023-01-13T12:28:32.316Z","dependency_job_id":null,"html_url":"https://github.com/NMFR/optimize-css-assets-webpack-plugin","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NMFR%2Foptimize-css-assets-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NMFR%2Foptimize-css-assets-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NMFR%2Foptimize-css-assets-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NMFR%2Foptimize-css-assets-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NMFR","download_url":"https://codeload.github.com/NMFR/optimize-css-assets-webpack-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"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-assets","css-processor","minimisation","minimization","minimizes","webpack-plugin"],"created_at":"2024-09-24T20:11:07.988Z","updated_at":"2025-05-14T05:10:47.306Z","avatar_url":"https://github.com/NMFR.png","language":"JavaScript","readme":"# Optimize CSS Assets Webpack Plugin\n\nA Webpack plugin to optimize \\ minimize CSS assets.\n\n\u003e :warning: For webpack v5 or above please use [css-minimizer-webpack-plugin](https://github.com/webpack-contrib/css-minimizer-webpack-plugin) instead.\n\n## What does the plugin do?\n\nIt will search for CSS assets during the Webpack build and will optimize \\ minimize the CSS (by default it uses [cssnano](http://github.com/ben-eb/cssnano) but a custom CSS processor can be specified).\n\n### Solves [extract-text-webpack-plugin](http://github.com/webpack/extract-text-webpack-plugin) CSS duplication problem:\n\nSince [extract-text-webpack-plugin](http://github.com/webpack/extract-text-webpack-plugin) only bundles (merges) text chunks, if it's used to bundle CSS, the bundle might have duplicate entries (chunks can be duplicate free but when merged, duplicate CSS can be created).\n\n## Installation:\n\nUsing npm:\n```shell\n$ npm install --save-dev optimize-css-assets-webpack-plugin\n```\n\n\u003e :warning: For webpack v3 or below please use `optimize-css-assets-webpack-plugin@3.2.0`. The `optimize-css-assets-webpack-plugin@4.0.0` version and above supports webpack v4.\n\n## Configuration:\n\nThe plugin can receive the following options (all of them are optional):\n* `assetNameRegExp`: A regular expression that indicates the names of the assets that should be optimized \\ minimized. The regular expression provided is run against the filenames of the files exported by the `ExtractTextPlugin` instances in your configuration, not the filenames of your source CSS files. Defaults to `/\\.css$/g`\n* `cssProcessor`: The CSS processor used to optimize \\ minimize the CSS, defaults to [`cssnano`](http://github.com/ben-eb/cssnano). This should be a function that follows `cssnano.process` interface (receives a CSS and options parameters and returns a Promise).\n* `cssProcessorOptions`: The options passed to the `cssProcessor`, defaults to `{}`\n* `cssProcessorPluginOptions`: The plugin options passed to the `cssProcessor`, defaults to `{}`\n* `canPrint`: A boolean indicating if the plugin can print messages to the console, defaults to `true`\n\n## Example:\n\n``` javascript\nvar OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.css$/,\n        loader: ExtractTextPlugin.extract('style-loader', 'css-loader')\n      }\n    ]\n  },\n  plugins: [\n    new ExtractTextPlugin('styles.css'),\n    new OptimizeCssAssetsPlugin({\n      assetNameRegExp: /\\.optimize\\.css$/g,\n      cssProcessor: require('cssnano'),\n      cssProcessorPluginOptions: {\n        preset: ['default', { discardComments: { removeAll: true } }],\n      },\n      canPrint: true\n    })\n  ]\n};\n```\n\n## License\n\nMIT (http://www.opensource.org/licenses/mit-license.php)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmfr%2Foptimize-css-assets-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnmfr%2Foptimize-css-assets-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnmfr%2Foptimize-css-assets-webpack-plugin/lists"}