技術

【Angular】component.htmlをprettierで整形する

投稿日:

こんにちは

今回はcomponent.htmlをprettierで整形する方法を紹介したいと思います。

prettierとangular-html-parserをインストールします。

$ npm i prettier angular-html-parser --save-dev

インストールしたらpackage.jsonに以下を記述します。

"scripts": {
  "prettier-html": "prettier --parser angular --write **/*.component.html"
}

npm scriptを実行します。

$ npm run prettier-html

これでcomponet.htmlがprettierによって整形されるようになりました。

-技術

執筆者:


comment

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください

関連記事

no image

【AWS】nginx/rails/mysqlをインストール

どうも、中田です。 最近AWSにテストサーバを立ち上げて検証したり、 お客様に一 …

どうも中田です。 Rails5.2から config/credentials.y …

no image

heroku + node.jsでError R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

こんにちは heroku + node.jsでアプリを作っていて、いざherok …

no image

【javascript】連想配列から特定の条件で新しい配列を作成する

こんにちは javascriptにはfilterという便利な関数があります。 例 …

no image

【Angular7】ファイルの指定をルート相対パスにする

こんにちは Angularで別ファイル(例えばcomponentからservic …