For gulp, just compress the CSS inside the page and generate it in this folder. Min's File

Source: Internet
Author: User
Tags html comment

Gulpfile.js file:

var gulp = require (' Gulp '),
Htmlmin = require (' gulp-htmlmin ');

Gulp.task (' Default ', function () {
Put your default task code here.
Const OPTIONS = {
Removecomments:true,//Clear HTML comment
Collapsewhitespace:true,//Compressed HTML
Collapsebooleanattributes:true,//omitting the value of the Boolean property <input checked= "true"/> ==> <input, checked/>
Removeemptyattributes:true,//Remove all spaces for attribute value <input id= ""/> ==> <input/>
Removescripttypeattributes:true,//delete <script> type= "Text/javascript"
Removestylelinktypeattributes:true,//delete <style> <link> type= "Text/css"
Minifyjs:true,//Compressed page JS
Minifycss:true//Compressed page CSS
};
Return gulp.src (' *.html ')
. Pipe (Htmlmin (options))
. Pipe (Gulp.dest (' *.min.html '));

});


The top function can be adjusted as needed, such as when I use only the MINIFYCSS option.

Create a good gulpfile.css in the folder, as long as cmd, and then download the Gulp related components, and then run gulp can be

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.