{"id":13401888,"url":"https://github.com/coderaiser/minify","last_synced_at":"2025-07-01T23:07:44.147Z","repository":{"id":3839015,"uuid":"4921167","full_name":"coderaiser/minify","owner":"coderaiser","description":"Minifier of js, css, html and img","archived":false,"fork":false,"pushed_at":"2025-05-26T18:48:34.000Z","size":800,"stargazers_count":243,"open_issues_count":2,"forks_count":32,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-06-15T03:41:27.322Z","etag":null,"topics":["css","hacktoberfest","html","javascript","minify","uglify"],"latest_commit_sha":null,"homepage":"https://coderaiser.github.io/minify","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/coderaiser.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":"CONTRIBUTING.md","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":"2012-07-06T07:44:38.000Z","updated_at":"2025-06-14T23:31:33.000Z","dependencies_parsed_at":"2023-12-13T10:24:50.027Z","dependency_job_id":"9b1c36bb-9364-437a-a564-1244a0730009","html_url":"https://github.com/coderaiser/minify","commit_stats":{"total_commits":981,"total_committers":19,"mean_commits":51.63157894736842,"dds":0.3628950050968399,"last_synced_commit":"c3a1732c901f0d89c19e31dabb68401512c16567"},"previous_names":[],"tags_count":151,"template":false,"template_full_name":null,"purl":"pkg:github/coderaiser/minify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fminify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fminify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fminify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fminify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderaiser","download_url":"https://codeload.github.com/coderaiser/minify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderaiser%2Fminify/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260101909,"owners_count":22959040,"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","hacktoberfest","html","javascript","minify","uglify"],"created_at":"2024-07-30T19:01:08.621Z","updated_at":"2025-07-01T23:07:44.118Z","avatar_url":"https://github.com/coderaiser.png","language":"JavaScript","readme":"# Minify [![License][LicenseIMGURL]][LicenseURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![NPM version][NPMIMGURL]][NPMURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]\n\n[NPMIMGURL]: https://img.shields.io/npm/v/minify.svg?style=flat\n[BuildStatusURL]: https://github.com/coderaiser/minify/actions\n[BuildStatusIMGURL]: https://github.com/coderaiser/minify/workflows/CI/badge.svg\n[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat\n[NPM_INFO_IMG]: https://nodei.co/npm/minify.png?stars\n[NPMURL]: http://npmjs.org/package/minify\n[LicenseURL]: https://tldrlegal.com/license/mit-license \"MIT License\"\n[CoverageURL]: https://coveralls.io/github/coderaiser/minify?branch=master\n[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/minify/badge.svg?branch=master\u0026service=github\n\n[Minify](http://coderaiser.github.io/minify \"Minify\") - a minifier of `js`, `css`, `html` and `img` files.\n\nTo get things done **Minify** uses this amazing tools:\n\n- ✅ [@putout/minify](https://github.com/putoutjs/minify);\n- ✅ [html-minifier](https://github.com/kangax/html-minifier);\n- ✅ [clean-css](https://github.com/jakubpawlowicz/clean-css);\n- ✅ [lightningcss](https://lightningcss.dev/);\n- ✅ [css-base64-images](https://github.com/Filirom1/css-base64-images);\n\n## Install\n\nFor Node users:\n\n```sh\nnpm i minify -g\n```\n\nFor Deno users:\n\n```js\nimport {minify} from 'npm:minify';\n```\n\n## How to use?\n\n### CLI\n\n```sh\nUsage: minify [options]\nOptions:\n  -h, --help                  display this help and exit\n  -v, --version               display version and exit\n  --js                        minify javascript\n  --css                       minify css\n  --html                      minify html\n  --auto                      auto detect format\n```\n\nThe bash command below creates a code snippet saved as `hello.js`.\n\nSimply copy + paste the code starting with cat, including the EOT on the last line, and press \u003center\u003e.\n\n```sh\n$ cat \u003c\u003c EOT \u003e hello.js\nconst hello = 'world';\n\nfor (let i = 0; i \u003c hello.length; i++) {\n    console.log(hello[i]);\n}\nEOT\n```\n\nUse the command `minify` followed by the path to and name of the js file intended to be minified. This will minify the code and output it to the screen.\n\n```sh\n$ minify hello.js\nvar a='world';for(let i=0;i\u003ca.length;i++)console.log(a[i]);\n```\n\nYou can capture the output with the following:\n\n```sh\n$ minify hello.js \u003e hello.min.js\n```\n\nYou can pass input using `cat`:\n\n```sh\ncat \u003c\u003c EOT | bin/minify.js --js\n\u003e const hello = 'world';\n\u003e\n\u003e for (let i = 0; i \u003c hello.length; i++) {\n\u003e     console.log(hello[i]);\n\u003e }\n\u003e EOT\nvar a='world';for(let i=0;i\u003ca.length;i++)console.log(a[i]);\n```\n\n`Minify` can be used with `async-await` and [try-to-catch](https://github.com/coderaiser/try-to-catch):\n\n```js\nimport {minify} from 'minify';\nimport tryToCatch from 'try-to-catch';\n\nconst options = {\n    html: {\n        removeAttributeQuotes: false,\n        removeOptionalTags: false,\n    },\n};\n\nconst [error, data] = await tryToCatch(minify, './client.js', options);\n\nif (error)\n    return console.error(error.message);\n\nconsole.log(data);\n```\n\n## Options\n\nFor cli use these options can be provided in a JSON file named `.minify.json` like so:\n\n```json\n{\n    \"js\": {\n        \"type\": \"putout\",\n        \"putout\": {\n            \"quote\": \"'\",\n            \"mangle\": true,\n            \"mangleClassNames\": true,\n            \"removeUnusedVariables\": true,\n            \"removeConsole\": false,\n            \"removeUselessSpread\": true\n        }\n    },\n    \"img\": {\n        \"maxSize\": 4096\n    },\n    \"html\": {\n        \"removeComments\": true,\n        \"removeCommentsFromCDATA\": true,\n        \"removeCDATASectionsFromCDATA\": true,\n        \"collapseWhitespace\": true,\n        \"collapseBooleanAttributes\": true,\n        \"removeAttributeQuotes\": true,\n        \"removeRedundantAttributes\": true,\n        \"useShortDoctype\": true,\n        \"removeEmptyAttributes\": true,\n        \"removeEmptyElements\": false,\n        \"removeOptionalTags\": true,\n        \"removeScriptTypeAttributes\": true,\n        \"removeStyleLinkTypeAttributes\": true,\n        \"minifyJS\": true,\n        \"minifyCSS\": true\n    },\n    \"css\": {\n        \"type\": \"clean-css\",\n        \"clean-css\": {\n            \"compatibility\": \"*\"\n        }\n    }\n}\n```\n\n**Minify** walking up parent directories to locate and read it’s configuration file `.minify.json`.\n\n### `js`\n\nIn section related to `js` you can choose `type` of minifier:\n\n- [`putout`](https://github.com/coderaiser/putout); (default);\n- [`terser`](https://github.com/terser/terser#minify-options);\n- [`esbuild`](https://esbuild.github.io/);\n- [`swc`](https://swc.rs/docs/configuration/minification);\n\nWhen you want to pass [options](https://github.com/terser/terser#minify-options) to `terser`, use section with the same name, `.minify.json` will look this way:\n\n```json\n{\n    \"js\": {\n        \"type\": \"terser\",\n        \"terser\": {\n            \"mangle\": false\n        }\n    }\n}\n```\n\n## License\n\nMIT\n","funding_links":[],"categories":["JavaScript","🔧 Utilities \u0026 Miscellaneous"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderaiser%2Fminify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderaiser%2Fminify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderaiser%2Fminify/lists"}