Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An opinionated Blade file formatter for VSCode

License

NotificationsYou must be signed in to change notification settings

shufo/vscode-blade-formatter

Repository files navigation

CIVisual Studio Marketplace InstallsVisual Studio Marketplace DownloadsVisual Studio Marketplace VersionVisual Studio Marketplace Rating

vscode-blade-formatter

An opinionated Blade file formatter for VSCode. Marketplace page ishere.

You can also format programmatically with the same syntax using theblade-formatter that this extension relies on.

Features

  • Automatically indent markup inside directives
  • Automatically add spacing to blade template markers
  • PHP 8 support (null safe operator, named arguments) 🐘
  • PSR-2 support (format inside directives)
  • Automatically sort Tailwind CSS classes with respect oftailwind.config.js

Screencast

Screencast

Extension Settings

settingdescriptiondefault
Blade Formatter: format EnabledWhether it enables or nottrue
Blade Formatter: format Indent SizeAn indent size4
Blade Formatter: format Wrap Line LengthThe length of line wrap size120
Blade Formatter: format Wrap AttributesThe way to wrap attributes.[auto|force|force-aligned|force-expand-multiline|aligned-multiple|preserve|preserve-aligned]auto
Blade Formatter: format Wrap Attributes Min AttrsMinimum number of html tag attributes for force wrap attribute options. Wrap the first attribute only ifforce-expand-multiline is specified in wrap attributes2
Blade Formatter: format Sort Tailwind Css ClassesSort Tailwind CSS classes automaticallyfalse
Blade Formatter: format Sort HTML AttributesSort HTML Attributes in the specified order. [none |alphabetical |code-guide |idiomatic |vuejs]none
Blade Formatter: format Indent Inner HtmlIndent<head> and<body> sections in html.false
Blade Formatter: format use TabsUse tab as indentation characterfalse
Blade Formatter: format Custom Html Attributes OrderComma separated custom HTML attributes order. e.g.id, data-.+, class, name. To enable this you must specify sort html attributes option ascustom. You can use regex for attribute names.none
Blade Formatter: format No Multiple Empty LinesCollapses multiple blank lines into a single blank line.false
Blade Formatter: format No PHP Syntax CheckDisable PHP Syntax check. Enabling this will suppress syntax error reporing.""
Blade Formatter: format No Single QuoteUse double quotes instead of single quotes for php expression.false
Blade Formatter: format No Trailing Comma PhpIf set to true, no trailing commas are printed for php expression.false
Blade Formatter: format Component PrefixSpecify custom prefixes for component names separated by comma. e.g.x-,livewire. This changes the format rules applied to custom components e.g. preserve style in attributes.x-,livewire
Blade Formatter: format PHP VersionA php version using for syntax compatibility.8.4
Blade Formatter: Dont Show New Version MessageIf set to 'true', the new version message won't be shown anymore.false

Configuration file: .bladeformatterrc.json or .bladeformatterrc

To configure settings per project, put.bladeformatterrc.json or.bladeformatterrc to your project root will vscode-blade-formatter treat it as setting files.

Configuration file will like below:

{"indentSize":4,"wrapAttributes":"auto","wrapAttributesMinAttrs":2,"wrapLineLength":120,"endWithNewLine":true,"noMultipleEmptyLines":false,"useTabs":false,"sortTailwindcssClasses":true,"sortHtmlAttributes":"none","noPhpSyntaxCheck":false,"noSingleQuote":false,"noTrailingCommaPhp":false,"componentPrefix": ["x-","livewire:"],"phpVersion":"8.4"}

Ignoring Files: .bladeignore

To exclude files from formatting, create a.bladeignore file in the root of your project..bladeignore usesgitignore syntax

# Ignore email templatesresources/views/email/**

Disabling format in file

To disable formatting in your file, you can use blade comments in the following format:

{{-- blade-formatter-disable--}}{{$foo}}{{$bar}}{{-- blade-formatter-enable--}}

To disable formatting on a specific line, you can use comment in the following format:

{{-- blade-formatter-disable-next-line--}}{{$foo}}

To disable formatting for an entire file, put a{{-- blade-formatter-disable --}} comment at the beginning of the file:

{{-- blade-formatter-disable--}}{{$foo}}

TODO

  • Add more option for HTML formatting rules
  • Add option for PHP formatting rules
  • Automate package publishing flow
  • Integration test

Release Notes

seeCHANGELOG.md

Related Projects

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Development

$ yarn install$ cp .env.example .env# set your app insight key$ yarn run watch# watch changes

Testing

$ yarn install$ cp .env.example .env# set your app insight key$ yarn run compile$ yarn runtest

Sponsors

Contributors

shufo
Shuhei Hayashibara
slovenianGooner
SlovenianGooner
yaegassy
Yaegassy
notdian
Null
1cbyc
Isaac Emmanuel
j3j5
Julio J. Foulquie
snyk-bot
Snyk Bot

LICENSE

MIT

Data and telemetry

This extension collects usage data and sends it toAzure Application Insight to improve extension. This extension respects thetelemetry.enableTelemetry setting.

To opt out, please set thetelemetry.enableTelemetry setting to false. Learn more inFAQ.

Sponsor this project

  •  

Packages

No packages published

Contributors10


[8]ページ先頭

©2009-2025 Movatter.jp