LoginSignup
0
0

More than 5 years have passed since last update.

FontAwesome 5のJSのCSSの自動挿入をやめさせる

Posted at

FontAwesome 5のJSをブラウザで使っていると、head内にcssが自動挿入されます。

このCSS(fontawesome.dom.css()で取得できる)をほかの定義とまとめていると、この操作は不要です。
イケてないし、どうにかしてやめさせたいなぁ、と1年ぐらい思ってました。

さっき調べたら、なんとその方法があったんです……!(いや、なきゃ困る)

やめさせ方

※TypeScriptをWebpackでバンドルしている場合の例です。

import { config } from "@fortawesome/fontawesome-svg-core"
config.autoAddCss = false

結論

APIドキュメントをちゃんと読もう!

https://fontawesome.com/how-to-use/with-the-api/setup/configuration

0
0
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
0
0