React-styleguidist: How to add favicon to styleguide document?

Created on 21 Aug 2017  ·  4Comments  ·  Source: styleguidist/react-styleguidist

Hi, I'm trying to add a favicon to my styleguide document via HtmlWebpackPlugin. However, in Configuring webpack it mentioned that HtmlWebpackPlugin would be ignored cause styleguidist also has this plugin. So how can I add favicon to the generated html page? Is there another way to achieve it?

question

Most helpful comment

I just had this issue too, for anyone struggling...

  • Create /src/assets/ directory, and put your favicon.ico file inside.
  • In your styleguide.config.js file (should be at root), add the assetsDir config:
module.exports = {
  assetsDir: 'src/assets/',
  template: 'src/templates/index.html' // add this file if you want to use other favicon links
}

All 4 comments

  1. Just put a favicon.ico file if you deploy your style guide into the server root folder.

  2. Add a custom HTML template using the template option.

@sapegin Thanks for reply. I ended up with adding a template file and specified a favicon link in template. I think it would be best if there is a favicon config option in styleguidist configuration since HtmlWebpackPlugin also has this config option.

@hueyhe can you explain me what was your workaround?

I just had this issue too, for anyone struggling...

  • Create /src/assets/ directory, and put your favicon.ico file inside.
  • In your styleguide.config.js file (should be at root), add the assetsDir config:
module.exports = {
  assetsDir: 'src/assets/',
  template: 'src/templates/index.html' // add this file if you want to use other favicon links
}
Was this page helpful?
0 / 5 - 0 ratings