5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

環境ごとにfaviconを変える

Posted at

開発環境と本番環境で favicon を変える

開発環境と本番環境をブラウザ上で間違って操作してしまった経験はありませんか?僕はあります。

僕もよくあります。。。(さっきもやっちまった)
設定したのでメモがてら。

application_helper.rb
def display_favicon
  if Rails.env.production?
    favicon_link_tag '/favicon.ico'
  else
    favicon_link_tag "/favicon-#{Rails.env}.ico"
  end
end
application.html.haml
%head= display_favicon

public配下に環境ごとのfaviconを置く。
一目で分かる色にしておくとよいですね。

favicon-env.png

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?