【问题标题】:Webpack merge header template to header tagWebpack 将标头模板合并到标头标签
【发布时间】:2017-11-06 06:54:53
【问题描述】:

我也在使用 WEBPACK 和 HtmlWebpackPlugin。 我创建了静态 header.html,它是静态文件,我希望将此文件的内容附加到 <header> 标记中的项目中的所有文件中。

我想对 footer.html 做同样的事情 因此,当我使用 Webpack 构建项目时,我有带有页眉和页脚的 html 文件。

【问题讨论】:

    标签: html node.js webpack build html-webpack-plugin


    【解决方案1】:

    你可以像这样使用HtmlWebpackPlugin。

    plugins : [
        new HtmlWebpackPlugin({
            template: './src/index.html'
            filename: './index.html'
        }),
        new HtmlWebpackPlugin({
            template: './src/header.html',
            filename: './header.html'
        }),
        new HtmlWebpackPlugin({
            template: './src/footer.html',
            filename: './footer.html'
        }),
        ...
    ]
    

    这将对您有所帮助。 :)

    【讨论】:

      猜你喜欢
      • 2018-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-29
      • 1970-01-01
      • 2011-03-31
      • 1970-01-01
      • 2010-12-28
      相关资源
      最近更新 更多