{"id":14062830,"url":"https://github.com/anseki/htmlclean-cli","last_synced_at":"2026-04-02T18:49:51.465Z","repository":{"id":57151711,"uuid":"86605775","full_name":"anseki/htmlclean-cli","owner":"anseki","description":"Simple and safety HTML/SVG cleaner to minify without changing its structure.","archived":false,"fork":false,"pushed_at":"2022-08-19T03:14:52.000Z","size":58,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-14T16:55:50.812Z","etag":null,"topics":["clean","comment","compress","html","lightweight","linebreak","minify","svg","whitespace"],"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/anseki.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":"2017-03-29T16:36:21.000Z","updated_at":"2025-10-06T09:21:09.000Z","dependencies_parsed_at":"2022-08-31T00:50:36.321Z","dependency_job_id":null,"html_url":"https://github.com/anseki/htmlclean-cli","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/anseki/htmlclean-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anseki%2Fhtmlclean-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anseki%2Fhtmlclean-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anseki%2Fhtmlclean-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anseki%2Fhtmlclean-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anseki","download_url":"https://codeload.github.com/anseki/htmlclean-cli/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anseki%2Fhtmlclean-cli/sbom","scorecard":{"id":198002,"data":{"date":"2025-08-11","repo":{"name":"github.com/anseki/htmlclean-cli","commit":"9bd37e2fe1bd61b0b9cc7dd865649f2e6255c1af"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-16T22:11:23.202Z","repository_id":57151711,"created_at":"2025-08-16T22:11:23.202Z","updated_at":"2025-08-16T22:11:23.202Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31313423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["clean","comment","compress","html","lightweight","linebreak","minify","svg","whitespace"],"created_at":"2024-08-13T07:02:30.758Z","updated_at":"2026-04-02T18:49:51.445Z","avatar_url":"https://github.com/anseki.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# htmlclean-cli\n\n[![npm](https://img.shields.io/npm/v/htmlclean-cli.svg)](https://www.npmjs.com/package/htmlclean-cli) [![GitHub issues](https://img.shields.io/github/issues/anseki/htmlclean-cli.svg)](https://github.com/anseki/htmlclean-cli/issues) [![David](https://img.shields.io/david/anseki/htmlclean-cli.svg)](package.json) [![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nCommand Line Tool - Simple and safety HTML/SVG cleaner to minify without changing its structure.  \nThis is CLI for [htmlclean](https://github.com/anseki/htmlclean).\n\n## Installation\n\n```shell\nnpm install -g htmlclean-cli\n```\n\n## Drag \u0026 Drop \u0026 Clean\n\nIn GUI environment, you can drag-and-drop one or more target files or directories to the `htmlclean` icon, or a short cut (alias, link, etc.) icon on the desktop also works.  \n![desktop](gui.png)\n\nThe `htmlclean` icon is found in:\n\n```shell\nnpm bin -g\n```\n\n## Command Line\n\n```shell\nhtmlclean [options] [input1 [input2 ...]]\n```\n\n### Options\n\n\u003ctable\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003e-h\u003c/code\u003e, \u003ccode\u003e--help\u003c/code\u003e\u003c/td\u003e\u003ctd\u003eoutput usage information\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003e-V\u003c/code\u003e, \u003ccode\u003e--version\u003c/code\u003e\u003c/td\u003e\u003ctd\u003eoutput the version number\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003e-i\u003c/code\u003e, \u003ccode\u003e--input \u0026lt;input\u0026gt;\u003c/code\u003e\u003c/td\u003e\u003ctd\u003einput file, directory or \u003ccode\u003e-\u003c/code\u003e as STDIN\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003e-o\u003c/code\u003e, \u003ccode\u003e--output \u0026lt;output\u0026gt;\u003c/code\u003e\u003c/td\u003e\u003ctd\u003eoutput file, directory or \u003ccode\u003e-\u003c/code\u003e as STDOUT\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003e-r\u003c/code\u003e, \u003ccode\u003e--root \u0026lt;directory\u0026gt;\u003c/code\u003e\u003c/td\u003e\u003ctd\u003eroot of directory tree\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003e-p\u003c/code\u003e, \u003ccode\u003e--protect \u0026lt;RegExp\u0026gt;\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e/pattern/flags\u003c/code\u003e for protect\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003e-P\u003c/code\u003e, \u003ccode\u003e--unprotect \u0026lt;RegExp\u0026gt;\u003c/code\u003e\u003c/td\u003e\u003ctd\u003e\u003ccode\u003e/pattern/flags\u003c/code\u003e for unprotect\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003e-e\u003c/code\u003e, \u003ccode\u003e--encoding \u0026lt;encoding\u0026gt;\u003c/code\u003e\u003c/td\u003e\u003ctd\u003eencoding method [\u003ccode\u003eutf8\u003c/code\u003e]\u003c/td\u003e\u003c/tr\u003e\n\u003ctr\u003e\u003ctd\u003e\u003ccode\u003e-v\u003c/code\u003e, \u003ccode\u003e--verbose\u003c/code\u003e\u003c/td\u003e\u003ctd\u003eoutput I/O information to STDERR\u003c/td\u003e\u003c/tr\u003e\n\u003c/table\u003e\n\n### `\u003cinput\u003e` / `\u003coutput\u003e`\n\nAn argument that have no option is considered as input.  \nFor example:\n\n```shell\nhtmlclean A.html\n```\n\nequals:\n\n```shell\nhtmlclean -i A.html\n```\n\nA `-` is specified as STDIN or STDOUT.\n\nIf multiple inputs and outputs are specified, the content from a first input is written to a first output, and the content from a second input is written to a second output..., in this way.  \nThe all arguments that have no option are added to last of the input list.  \nIf no inputs are specified, it's considered as one STDIN.  \nThe outputs exceeding inputs are ignored.  \nFor example:\n\n```shell\nhtmlclean -o A.html -o B.html\n```\n\nA first input is STDIN, `B.html` is ignored.\n\nIf a file is specified to the input of a pair and a directory is specified to the output of this pair, the content is written to the same named file in the specified directory. In this case, if the input path is located under the path that is specified to the `--root` option, the directory tree under the root path is created into the output directory.  \nIf a file is specified to the input of a pair and the output of this pair isn't specified, the content is written to the file named `\u003cinput\u003e.min.\u003cext\u003e`. For example, if the name of file as input is `index.html`, then the content is written to `index.min.html`.  \nIf STDIN is specified to the input of a pair and the output of this pair isn't specified (or a directory is specified), the content is written to STDOUT.\n\nThe input can be Glob pattern like `*.html`.  \nFor Glob pattern syntax, see:  \n[https://github.com/isaacs/node-glob](https://github.com/isaacs/node-glob)  \n[https://github.com/isaacs/minimatch](https://github.com/isaacs/minimatch)\n\nIf a directory is specified to the input, it is considered as `directory/**/*.html`. And this directory is set to default of the `--root` option.  \nIf the input of a pair points to multiple files and a directory is specified to the output of this pair, the each content is written to the same named file in the specified directory. In this case, if the input path is located under the path that is specified to the `--root` option, the directory tree under the root path is created into the output directory.  \nIf the input of a pair points to multiple files and the output of this pair isn't specified, the each content is written to the file named `\u003cinput\u003e.min.\u003cext\u003e`. For example, if the name of file as input is `index.html`, then the content is written to `index.min.html`.  \nIf the input of a pair points to multiple files and a file (or STDOUT) is specified to the output of this pair, a concatenated content from all input files of this pair is written to the output.\n\n#### Examples\n\n* Clean `index.html`, and write to `index.min.html`.\n\n```shell\nhtmlclean index.html\n```\n\n* Clean `index.html`, and overwrite it.\n\n```shell\nhtmlclean index.html -o index.html\n```\n\n* Clean all HTML files in `src` directory, and write into `public` directory.\n\n```shell\nhtmlclean src -o public\n```\n\n* Clean `index.html` in `src` directory, and write into `public` directory.\n\n```shell\nhtmlclean src/index.html -o public\n```\n\n* Clean 2 files.\n\n```shell\nhtmlclean -i A.html -o A.cln.html -i B.html -o B.cln.html\n```\n\n* Clean 2 files in `src` directory, and write into `public` directory.\n\n```shell\nhtmlclean -i src/A.html -o public -i src/B.html -o public\n```\n\n* Equal to above.\n\n```shell\nhtmlclean -i \"src/@(A|B).html\" -o public\n```\n\n* Clean all SVG files.\n\n```shell\nhtmlclean *.svg\n```\n\n* Get and clean web page on URL, and write to `index.html`.\n\n```shell\nwget -q -O - https://github.com/ | htmlclean -o index.html\n```\n\n* Clean and compress `index.html`, and write to `index.gz`.\n\n```shell\nhtmlclean index.html -o - | gzip \u003e index.gz\n```\n\n* From STDIN to `public/A.html`, from `src/B.html` to STDOUT.\n\n```shell\nhtmlclean -i - -o public/A.html -i src/B.html -o -\n```\n\n* Clean 3 files, and write into 1 file.\n\n```shell\nhtmlclean -i head.html -i body.html -i foot.html \\\n-o index.html -o index.html -o index.html\n```\n\n* Clean all HTML and SVG and PHP files.\n\n```shell\nhtmlclean *.{html,svg,php}\n```\n\n* Clean all files that has a number as the first character, and extension is `html` or `htm`.\n\n```shell\nhtmlclean [0-9]*.htm?(l)\n```\n\n### `--protect` / `--unprotect`\n\nThese must be a text like `/pattern/flags` as RegExp.  \nThe multiple options can be specified.  \nSee: [Options of htmlclean](https://github.com/anseki/htmlclean#options)\n\nFor example, for some Template Framework and AngularJS.\n\n```shell\nhtmlclean \\\n-p \"/\u003c\\!--%fooTemplate\\b.*?%--\u003e/g\" \\\n-p \"/\u003c\\!--%barTemplate\\b.*?%--\u003e/g\" \\\n-P \"/\u003cscript [^\u003e]*\\btype=\"text\\/ng-template\"[\\s\\S]+?\u003c\\/script\u003e/ig\"\n```\n\n## Note\n\nOn Windows XP, 2000 + Node v0.11-, the redirecting doesn't work, the piping works.  \nTherefore, use this:\n\n```shell\ntype file.html | htmlclean\n```\n\ninstead of:\n\n```shell\nhtmlclean \u003c file.html\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanseki%2Fhtmlclean-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanseki%2Fhtmlclean-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanseki%2Fhtmlclean-cli/lists"}