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

How to batch compress html pages using node?

云罗郡主
Release: 2018-11-21 16:05:49
forward
2350 people have browsed it

The content of this article is about how to use node to batch compress HTML pages. 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 installation html-minifier

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

How to batch compress html pages using node?

Code before compression: How to batch compress html pages using node?

Code after compression:

How to batch compress html pages using node?

Run node index After the command, all HTML pages in the source directory will be compressed in batches.

The above is the complete introduction to how to use node to batch compress html pages. If you want to know more about JavaScript tutorial, please pay attention to the PHP Chinese website.


The above is the detailed content of How to batch compress html pages using node?. 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