• Stars
    star
    4,209
  • Rank 10,276 (Top 0.3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 4 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An opinionated Blade file formatter for VSCode

CI Visual Studio Marketplace Installs Visual Studio Marketplace Downloads Visual Studio Marketplace Version Visual Studio Marketplace Rating

vscode-blade-formatter

An opinionated Blade file formatter for VSCode. Marketplace page is here.

You can also format programmatically with the same syntax using the blede-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 of tailwind.config.js

Screencast

Screencast

Extension Settings

setting description default
Blade Formatter: format Enabled Whether it enables or not true
Blade Formatter: format Indent Size An indent size 4
Blade Formatter: format Wrap Line Length The length of line wrap size 120
Blade Formatter: format Wrap Attributes The way to wrap attributes. [auto|force|force-aligned|force-expand-multiline|aligned-multiple|preserve|preserve-aligned] auto
Blade Formatter: format No Multiple Empty Lines Collapses multiple blank lines into a single blank line. false
Blade Formatter: format use Tabs Use tab as indentation character false
Blade Formatter: format Sort Tailwind Css Classes Sort Tailwind CSS classes automatically false
Blade Formatter: format Sort HTML Attributes Sort HTML Attributes in the specified order. [none | alphabetical | code-guide | idiomatic | vuejs] none
Blade Formatter: format Custom Html Attributes Order Comma separated custom HTML attributes order. e.g. id, data-.+, class, name. To enable this you must specify sort html attributes option as custom. You can use regex for attribute names. none
Blade Formatter: format No PHP Syntax Check Disable PHP Syntax check. Enabling this will suppress syntax error reporing. ""
Blade Formatter: Dont Show New Version Message If 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",
    "wrapLineLength": 120,
    "endWithNewLine": true,
    "noMultipleEmptyLines": false,
    "useTabs": false,
    "sortTailwindcssClasses": true,
    "sortHtmlAttributes": "none",
    "noPhpSyntaxCheck": false
}

Ignoring Files: .bladeignore

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

# Ignore email templates
resources/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

see CHANGELOG.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 run test

Sponsors

Contributors

shufo
Shuhei Hayashibara
slovenianGooner
SlovenianGooner
yaegassy
Yaegassy
dianfishekqi
Dian Fishekqi
1cbyc
Isaac Emmanuel
j3j5
Julio J. Foulquie

LICENSE

MIT

Data and telemetry

This extension collects usage data and sends it to Azure Application Insight to improve extension. This extension respects the telemetry.enableTelemetry setting.

To opt out, please set the telemetry.enableTelemetry setting to false. Learn more in FAQ.

More Repositories

1

blade-formatter

An opinionated blade template formatter for Laravel that respects readability
TypeScript
442
star
2

prettier-plugin-blade

Format your blade template using Prettier
TypeScript
326
star
3

nginx-consul-template

A dynamic configurable Nginx with Consul.
Shell
76
star
4

fcmex

A Firebase Cloud Message client for Elixir
Elixir
75
star
5

log_viewer

An Web based Log Viewer for Elixir and Phoenix
Elixir
59
star
6

ansible-haproxy-keepalived

A playbook building high availability Load Balancer with HAProxy and keepalived.
Shell
40
star
7

ex_doc_refined

A refined document viewer for Elixir and Phoenix
Elixir
34
star
8

terraform-boilerplate-ecs-alb

Terraform boilerplate for ECS with ALB.
HCL
26
star
9

auto-assign-reviewer-by-files

A Github Action automatically assigns reviewers to PR based on changed files
JavaScript
22
star
10

python-lambda-image

A thumbnail generator with AWS lambda and python.
Python
18
star
11

cdn

CDN Assets Manager for Elixir
Elixir
15
star
12

go-graphql-boilerplate

A boilerplate for creating GraphQL server with Go
Go
14
star
13

joplin-plugin-markdown-prettier

Format your joplin notes by prettier
TypeScript
14
star
14

docker-phoenix

A script for creating elixir image for phoenix framework.
Dockerfile
10
star
15

ecs-fargate-oneshot

Executes oneshot task on ECS (Fargate)
Go
9
star
16

amazon-3rd-party-seller-filter

Chrome Extension that filtering out 3rd party seller's product on amazon search results
JavaScript
9
star
17

plug_rate_limit_redis

An Elixir plug rate limiting with redis
Elixir
8
star
18

shufo.dev

My homepage
TypeScript
8
star
19

online-blade-formatter

An opinionated blade formatter on online
Vue
8
star
20

tailwindcss-class-sorter

A tailwindcss class sorter that respects tailwind config file
TypeScript
5
star
21

ansible-sudo-ldap

A playbook for sudo administration with ldap server.
5
star
22

elixir_101

Getting Started Elixir with TDD
Elixir
4
star
23

html-attribute-sorter

An html attribute sorter
TypeScript
4
star
24

docker-teleport

A docker image of teleport.
Makefile
4
star
25

per-directory-history

A port of zsh's per directory history for fish shell
Shell
4
star
26

lambda-pdf-generator

A lambda function that generates PDF with headless chrome
HCL
4
star
27

plug_cache

An Elixir plug to cache the response
Elixir
4
star
28

payjp-elixir

An Elixir library for working with PAY.JP.
Elixir
4
star
29

laravel-opensearch

An easy way to use the official OpenSearch client in your Laravel applications.
PHP
4
star
30

ansible-skype-hubot

A playbook for skype and hubot integration on CentOS.
CoffeeScript
3
star
31

plug_robots

An Elixir plug serving robots.txt.
Elixir
3
star
32

phoenix_api_101

Elixir
3
star
33

docker-v8js-php7

A v8js image with php 7.
3
star
34

docker-microservice-template

A template for create your own microservice with docker
Shell
3
star
35

phoenix_101

Elixir
3
star
36

branchlint

A git branch linter to enforce branch naming convention
JavaScript
3
star
37

ansible-openssh-openldap

A playbook for SSH key authentication via OpenLDAP
Shell
3
star
38

bom

An elixir library for working with BOM (byte order mark).
Elixir
2
star
39

auto-assign-reviewer-by-issuer

A GitHub Action to automatically assigns reviewer by issuer
JavaScript
2
star
40

learning-elixir-with-tdd

Learn Elixir with TDD
Elixir
2
star
41

activity_log

A logger with Activitiy Streams like format for Elixir
Elixir
2
star
42

paidy-elixir

An Elixir library for working with Paidy
Elixir
2
star
43

auto-assign-reviewer-by-assignee

A GitHub Action automatically assigns reviewers by assignee
JavaScript
2
star
44

docker-phantomjs

A Dockerized phantomjs image.
1
star
45

timed-url-opener

Automatically open a specific URL at a scheduled time in your browser
TypeScript
1
star
46

docker-v8

A v8 engine image.
1
star
47

lambda-query

A serverless DB querying client with Lambda
Go
1
star
48

ex_redis_101

Elixir
1
star
49

ansible-redhat-lamp

A playbook to setup LAMP stack on a CentOS Vagrant virtual machine.
1
star
50

docker-go-graphql-base

Dockerfile
1
star
51

docker-laravel-alpine

Laravel 5.*, 6.*, 7.*, 8.* ready image with composer
Dockerfile
1
star
52

plug_maintenance

An Elixir plug returns a service unavailable response during maintenance
Elixir
1
star
53

aspida

A social media detox app built with Electron and Vue.js in TypeScript
JavaScript
1
star
54

ex_line_pay

A LINE Pay client for Elixir
Elixir
1
star
55

ex_aws_101

Elixir
1
star