欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

index.html打包插入注释

程序员文章站 2022-07-12 21:09:45
...

HTML:

<!--
 <%= htmlWebpackPlugin.options.buildInfo %>
 -->
 <!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <meta name="format-detection" content="telephone=no" />
  <title>伽罗瓦</title>
  <link rel="shortcut icon" href="/static/images/data_logo.png" />
  <link rel="stylesheet" href="/static/css/reset.css">
</head>

plugin设置

new HtmlWebpackPlugin({
    hash: true,
    filename: 'index.html',
    template: path.resolve(__dirname, '../src/index.html'),
    buildInfo: '插入的注释内容'
  }),
相关标签: webpack