LoginSignup
8
3

More than 5 years have passed since last update.

angular-cliでfont-awesomeを使う方法

Posted at

angular-cliでfont-awesomeを使ったときのメモ

事前準備

angular-cliでプロジェクトを作成する。(angular-cliのインストールとかは省略)

$ ng new fontawesome-example --skip-git
$ cd fontawesome-example

font-awesomeのインストール

$ npm install -save font-awesome

angular-cli.jsonの編集

angular-cli.json
{
  ...
  "apps": [
    {
      ...
      "styles": [
+       "../node_modules/font-awesome/css/font-awesome.css",
        "styles.css"
      ],
      ...
    }
  ],
  "addons": [
+   "../node_modules/font-awesome/fonts/*.+(otf|eot|svg|ttf|woff|woff2)"
  ],
  ...
}

使ってみる

src/app/app.component.html
<h1>
+ <i class="fa fa-user" aria-hidden="true"></i>
  {{title}}
</h1>

起動

$ ng serve

localhost:4200にアクセスしてみる。

20161003_162147_0000.png

以上!

8
3
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
8
3