How to use a favicon with ember-cli?

痞子三分冷 提交于 2019-12-23 07:12:47

问题


I had a favicon working for a while on my index template, but not any any other template, and now even my index template won't show it.

I'm just in development, so I'm using ember server.

index.html
<link rel="icon" href="favicon.ico">

Just throwing around my favicon to see if it shows up anywhere, I now have it in the following locations: app/ public/ public/assets

I think this should be very straightforward, especially since the index page doesn't change, just get's new stuff loaded into its outlets, so I can't figure out why it can't find my favicon file.

When running ember server, where actually is the / root pointing to?


回答1:


If you keep the favicon file in public/assets/ you can reference it like this:

<link rel="icon" href="/assets/favicon.ico">

The Ember CLI docs have a good section on this




回答2:


You could also check out ember-cli-favicon.

It's an addon that takes your source public/favicon.png and automatically outputs all the different favicon formats and sizes for different devices, as well as injects the appropriate HTML into your index.html file as part of the build process.



来源:https://stackoverflow.com/questions/25648827/how-to-use-a-favicon-with-ember-cli

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!