美文网首页
vue设置网站图标favicon.ico

vue设置网站图标favicon.ico

作者: lesdom | 来源:发表于2019-07-19 13:02 被阅读0次

位置

favicon.ico放在根目录下

方式一

index.html

<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />

方式二

webpack.dev.conf.js

new HtmlWebpackPlugin({
  filename: 'index.html',
  template: 'index.html',
  favicon: 'favicon.ico', // 新增
  inject: true
}),

webpack.prod.conf.js

new HtmlWebpackPlugin({
  filename: config.build.index,
  template: 'index.html',
  inject: true,
  minify: {
    removeComments: true,
    collapseWhitespace: true,
    removeAttributeQuotes: true
    // more options:
    // https://github.com/kangax/html-minifier#options-quick-reference
  },
  // necessary to consistently work with multiple chunks via CommonsChunkPlugin
  chunksSortMode: 'dependency',
  favicon: 'favicon.ico' // 新增
}),

网站导航

网站导航

相关文章

网友评论

      本文标题:vue设置网站图标favicon.ico

      本文链接:https://www.haomeiwen.com/subject/vgvjlctx.html