How to inject custom meta tags in html-webpack-plugin?

前端 未结 3 1154
故里飘歌
故里飘歌 2021-01-01 00:09

I use Webpack along with the plugin html-webpack-plugin. Based on an environment variable, I want to inject a tag into th

3条回答
  •  粉色の甜心
    2021-01-01 00:39

    Try html-webpack-tags-plugin

    new HtmlWebpackTagsPlugin({
        metas: [{
            path: 'img/logo.png',
            attributes: {
                property: 'og:image'
            }
        },{
            attributes: {
                property: 'og:image:type',
                content: "image/png"
            }
        },{
            attributes: {
                property: 'og:image:width',
                content: "200"
            }
        },{
            attributes: {
                property: 'og:image:height',
                content: "200"
            }
        },]
    }),
    

提交回复
热议问题