10
10

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.

VSCodeでLaravel bladeをフォーマットできない件への対処

Posted at

#目的
VSCodeでLaravel bladeをフォーマットしたい

#環境
OS: MacOS Mohave
IDE: VSCode

#作業内容
VSCodeのコード整形プラグインであるBeutifyをインストール
Alt + Shift + Fキーで、コード整形ができるようになるはず

しかし、laravelのbladeファイルはこれでは整形されなかった

#類似事例
下記に同様のIssueがあったので、回避策を試してみる
https://stackoverflow.com/questions/41330707/how-to-format-php-files-with-html-markup-in-visual-studio-code/48339700#48339700

#回避策
原文

I added to my user config"beautify.language": { "js": { "type": [ "javascript", "json", "jsonc" ], "filename": [ ".jshintrc", ".jsbeautifyrc" ] }, "css": [ "css", "scss" ], "html": [ "htm", "html", "blade" ] },

VSCodeのPreferenceに上記を追加する。
Commando + P でsettings.jsonを開き、User settings内に追記

以上で、bladeファイルもAlt + Shift + Fキーで整形できるようになる。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?