技術

【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

[wordpress]contact form7で作ったformをコード内で呼び出す

こんばんは wordpressでformを作る時はcontact form7を使 …

[Xcode] SDK Version Issue – This app was built with the iOS 12.0 SDK. Starting March 2019, all iOS apps submitted to the App Store must be built with the iOS 12.1 SDK or later, included in Xcode 10.1 or later.

こんにちは。たなかです。 2019年、ブログ初更新になります。今年もよろしくお願 …

コマンド一つで「20190729」みたいなスラッシュなしの日付を入力したい!

こんにちは。たなかです。 Macで「きょう」と入力すると、今日の日付が予測変換さ …

no image

Angular6で子コンポーネントに文字列を渡す

文字列と変数の値を渡す時、記述が少しだけ違います。 // 文字列を渡したい時 & …

no image

[リアクティブフォーム]バリデーションチェックを任意のタイミングで走らせる。

Angularのリアクティブフォームで使っていると、 バリデーションを後付けした …