
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
htmlclean-cli
Advanced tools
Simple and safety HTML/SVG cleaner to minify without changing its structure.
Command Line Tool - Simple and safety HTML/SVG cleaner to minify without changing its structure.
This is CLI for htmlclean.
npm install -g htmlclean-cli
In 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.

The htmlclean icon is found in:
npm bin -g
htmlclean [options] [input1 [input2 ...]]
-h, --help | output usage information |
-V, --version | output the version number |
-i, --input <input> | input file, directory or - as STDIN |
-o, --output <output> | output file, directory or - as STDOUT |
-r, --root <directory> | root of directory tree |
-p, --protect <RegExp> | /pattern/flags for protect |
-P, --unprotect <RegExp> | /pattern/flags for unprotect |
-e, --encoding <encoding> | encoding method [utf8] |
-v, --verbose | output I/O information to STDERR |
<input> / <output>An argument that have no option is considered as input.
For example:
htmlclean A.html
equals:
htmlclean -i A.html
A - is specified as STDIN or STDOUT.
If 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.
The all arguments that have no option are added to last of the input list.
If no inputs are specified, it's considered as one STDIN.
The outputs exceeding inputs are ignored.
For example:
htmlclean -o A.html -o B.html
A first input is STDIN, B.html is ignored.
If 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.
If 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 <input>.min.<ext>. For example, if the name of file as input is index.html, then the content is written to index.min.html.
If 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.
The input can be Glob pattern like *.html.
For Glob pattern syntax, see:
https://github.com/isaacs/node-glob
https://github.com/isaacs/minimatch
If a directory is specified to the input, it is considered as directory/**/*.html. And this directory is set to default of the --root option.
If 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.
If 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 <input>.min.<ext>. For example, if the name of file as input is index.html, then the content is written to index.min.html.
If 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.
index.html, and write to index.min.html.htmlclean index.html
index.html, and overwrite it.htmlclean index.html -o index.html
src directory, and write into public directory.htmlclean src -o public
index.html in src directory, and write into public directory.htmlclean src/index.html -o public
htmlclean -i A.html -o A.cln.html -i B.html -o B.cln.html
src directory, and write into public directory.htmlclean -i src/A.html -o public -i src/B.html -o public
htmlclean -i "src/@(A|B).html" -o public
htmlclean *.svg
index.html.wget -q -O - https://github.com/ | htmlclean -o index.html
index.html, and write to index.gz.htmlclean index.html -o - | gzip > index.gz
public/A.html, from src/B.html to STDOUT.htmlclean -i - -o public/A.html -i src/B.html -o -
htmlclean -i head.html -i body.html -i foot.html \
-o index.html -o index.html -o index.html
htmlclean *.{html,svg,php}
html or htm.htmlclean [0-9]*.htm?(l)
--protect / --unprotectThese must be a text like /pattern/flags as RegExp.
The multiple options can be specified.
See: Options of htmlclean
For example, for some Template Framework and AngularJS.
htmlclean \
-p "/<\!--%fooTemplate\b.*?%-->/g" \
-p "/<\!--%barTemplate\b.*?%-->/g" \
-P "/<script [^>]*\btype="text\/ng-template"[\s\S]+?<\/script>/ig"
On Windows XP, 2000 + Node v0.11-, the redirecting doesn't work, the piping works.
Therefore, use this:
type file.html | htmlclean
instead of:
htmlclean < file.html
FAQs
Simple and safety HTML/SVG cleaner to minify without changing its structure.
The npm package htmlclean-cli receives a total of 5 weekly downloads. As such, htmlclean-cli popularity was classified as not popular.
We found that htmlclean-cli demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.