Home > Web Front-end > JS Tutorial > body text

How to use node to batch compress html pages (source code attached)

不言
Release: 2018-11-20 14:32:04
forward
2569 people have browsed it

The content of this article is about how to use node to batch compress HTML pages (source code attached). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Recently I am writing a backend management system using layui. For some reasons, html, css, and js are all written in .html, and no other packaging tools are used. So I wrote a small tool that uses the node command to batch compress pages and obfuscate js.
node installationhtml-minifier

The directory structure is as follows and can be changed by yourself.

How to use node to batch compress html pages (source code attached)

Code before compression

How to use node to batch compress html pages (source code attached)

Code after compression

How to use node to batch compress html pages (source code attached)

After running the node index command, all html pages in the source directory will be compressed in batches.
Check whether the compression is clear. Yes.

Codegithub address

The above is the detailed content of How to use node to batch compress html pages (source code attached). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!