{"id":13496567,"url":"https://github.com/vbenjs/vite-plugin-imagemin","last_synced_at":"2026-05-19T17:08:11.336Z","repository":{"id":37836196,"uuid":"335975268","full_name":"vbenjs/vite-plugin-imagemin","owner":"vbenjs","description":"A vite plugin for compressing image assets.","archived":false,"fork":false,"pushed_at":"2023-08-07T05:56:29.000Z","size":3491,"stargazers_count":234,"open_issues_count":25,"forks_count":32,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-09T22:17:42.201Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/vbenjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2021-02-04T14:15:02.000Z","updated_at":"2025-03-31T13:24:51.000Z","dependencies_parsed_at":"2024-06-18T13:39:41.071Z","dependency_job_id":"5cd8739a-92be-4578-b222-430a2dc762e2","html_url":"https://github.com/vbenjs/vite-plugin-imagemin","commit_stats":null,"previous_names":["anncwb/vite-plugin-imagemin"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vbenjs%2Fvite-plugin-imagemin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vbenjs%2Fvite-plugin-imagemin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vbenjs%2Fvite-plugin-imagemin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vbenjs%2Fvite-plugin-imagemin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vbenjs","download_url":"https://codeload.github.com/vbenjs/vite-plugin-imagemin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119286,"owners_count":21050755,"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":[],"created_at":"2024-07-31T19:01:51.827Z","updated_at":"2026-05-19T17:08:01.322Z","avatar_url":"https://github.com/vbenjs.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# vite-plugin-imagemin\n\n**English** | [中文](./README.zh_CN.md)\n\n[![npm][npm-img]][npm-url] [![node][node-img]][node-url]\n\nA vite plugin for compressing image assets\n\n## Install (yarn or npm)\n\n**node version:** \u003e=12.0.0\n\n**vite version:** \u003e=2.0.0\n\n```\nyarn add vite-plugin-imagemin -D\n```\n\nor\n\n```\nnpm i vite-plugin-imagemin -D\n```\n\n### China installation note\n\nBecause imagemin is not easy to install in China. Several solutions are now available\n\n1. Use yarn to configure in package.json (recommended)\n\n```json\n\"resolutions\": {\n    \"bin-wrapper\": \"npm:bin-wrapper-china\"\n  },\n\n```\n\n2. Use npm, add the following configuration to the computer host file\n\n```bash\n\n199.232.4.133 raw.githubusercontent.com\n```\n\n3. Install with cnpm (not recommended)\n\n## Usage\n\n- Configuration plugin in vite.config.ts\n\n```ts\nimport viteImagemin from 'vite-plugin-imagemin'\n\nexport default () =\u003e {\n  return {\n    plugins: [\n      viteImagemin({\n        gifsicle: {\n          optimizationLevel: 7,\n          interlaced: false,\n        },\n        optipng: {\n          optimizationLevel: 7,\n        },\n        mozjpeg: {\n          quality: 20,\n        },\n        pngquant: {\n          quality: [0.8, 0.9],\n          speed: 4,\n        },\n        svgo: {\n          plugins: [\n            {\n              name: 'removeViewBox',\n            },\n            {\n              name: 'removeEmptyAttrs',\n              active: false,\n            },\n          ],\n        },\n      }),\n    ],\n  }\n}\n```\n\n### Options\n\n| params   | type                                  | default | default                                                      |\n| -------- | ------------------------------------- | ------- | ------------------------------------------------------------ |\n| verbose  | `boolean`                             | `true`  | Whether to output the compressed result in the console       |\n| filter   | `RegExp or (file: string) =\u003e boolean` | -       | Specify which resources are not compressed                   |\n| disable  | `boolean`                             | `false` | Whether to disable                                           |\n| svgo     | `object` or `false`                   | -       | See [Options](https://github.com/svg/svgo/#what-it-can-do)   |\n| gifsicle | `object` or `false`                   | -       | See [Options](https://github.com/imagemin/imagemin-gifsicle) |\n| mozjpeg  | `object` or `false`                   | -       | See [Options](https://github.com/imagemin/imagemin-mozjpeg)  |\n| optipng  | `object` or `false`                   | -       | See [Options](https://github.com/imagemin/imagemin-optipng)  |\n| pngquant | `object` or `false`                   | -       | See [Options](https://github.com/imagemin/imagemin-pngquant) |\n| webp     | `object` or `false`                   | -       | See [Options](https://github.com/imagemin/imagemin-webp)     |\n\n## Example\n\n**Run Example**\n\n```bash\n\nnpm run dev:play\nnpm run dev:build\n\n```\n\n## Sample project\n\n[Vben Admin](https://github.com/anncwb/vue-vben-admin)\n\n## License\n\nMIT\n\n## Inspiration\n\n[vite-plugin-compress](https://github.com/alloc/vite-plugin-compress)\n\n[npm-img]: https://img.shields.io/npm/v/vite-plugin-imagemin.svg\n[npm-url]: https://npmjs.com/package/vite-plugin-imagemin\n[node-img]: https://img.shields.io/node/v/vite-plugin-imagemin.svg\n[node-url]: https://nodejs.org/en/about/releases/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvbenjs%2Fvite-plugin-imagemin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvbenjs%2Fvite-plugin-imagemin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvbenjs%2Fvite-plugin-imagemin/lists"}