zoukankan      html  css  js  c++  java
  • 初探webpack4--根据模版自动生成HTML

    1、根据HTML模版自动生成HTML
        了解html-webpack-plugin
          HtmlWebpaclPlugin会自动为你生成一个HTML文件,根据指定的index.html生成对应的html文件
        安装html-webpack-plugin插件
          npm install html-webpack-plugin --save-dev
        配置config文件
          const HtmlWebPackPlugin = require('html-webpack-plugin')
          plugins: [
            new HtmlWebPackPlugin({
              template: "./src/index.html",
              filename: 'index.html',
              minify: {
                minimize: true, //是否打包为最小值
                caseSensitive:false,//是否大小写敏感
                          collapseWhitespace:true//是否去除空格
                            removeAttributeQuotes:true// 去掉属性引用
                            removeComments:true,//去注释
                minifyJS: true //压缩html内的js
                minifyCSS: true //压缩html内的样式
                removeEmptyElements: true //清楚内容为空的元素
              }
            })
          ]

  • 相关阅读:
    C语言01
    C++面试总结更新
    Python网络爬虫与信息提取02
    Self-Driving Car 01
    Python网络爬虫与信息提取01
    Python-03
    Shell
    Python-05
    Python-04
    Python-02
  • 原文地址:https://www.cnblogs.com/webtaotao/p/12108053.html
Copyright © 2011-2022 走看看