webpack对html压缩,求助,webpack 如何打包html,在html中可以压缩哪些东西?如何配置?...
发布日期:2021-10-27 11:21:02
浏览次数:9
分类:技术文章
本文共 595 字,大约阅读时间需要 1 分钟。
1. 安装: html-webpack-plugin 插件完成打包
2. 命令:npm install html-webpack-plugin –save-dev
3. 配置:
引入:const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: 'index.js',
output: {
path: __dirname + '/dist',
filename: 'index_bundle.js'
},
plugins: [
new HtmlWebpackPlugin({
title: 'My App',(生成的页面标题)
filename: 'assets/admin.html',(生成的文件名)
template: 'src/assets/test.html',(原来的index.html)
minify: {
collapseWhitespace: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true
}
})
]
转载地址:https://blog.csdn.net/weixin_34518190/article/details/117782749 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
逛到本站,mark一下
[***.202.152.39]2024年04月17日 14时10分50秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
win7 远程桌面无法记住密码的解决方法
2019-04-26
说说 Python 的 range() 函数
2019-04-26
说说 ES6 的块级作用域
2019-04-26
说说 ES6 的 const 指令
2019-04-26
微服务设计笔记(2)——从架构师角度来看待微服务
2019-04-26
微服务设计笔记(3)——服务建模
2019-04-26
说说 Cookie 的 HttpOnly 属性
2019-04-26
说说 Python 的 None 值
2019-04-26
说说 Python print() 函数不为人知的特性
2019-04-26
说说 Python 的作用域
2019-04-26
说说 Python 的 global 标识对变量作用域的影响
2019-04-26
说说内存分析工具 MAT 的基本用法
2019-04-26
C++2 dimension vector
2019-04-26
SWIFT入门 Dictionary
2019-04-26
SWIFT SET
2019-04-26
swift operation
2019-04-26
利用NVIDIA TensorRT加速交通环境感知之亲测有效
2019-04-26
NVIDIA 第三届Sky Hackathon学深会踩坑实录~
2019-04-26
关于linkedin的network的观察和自己的职业道路的追求
2019-04-26
生死6小时!!!!!!!!!!!!!!!!1
2019-04-26