vue设置网站图标favicon.ico

2019-07-19  本文已影响0人  lesdom

位置

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' // 新增
}),

网站导航

网站导航

上一篇下一篇

猜你喜欢

热点阅读