Overview:
This product is a Prettier plugin specifically designed for formatting blade templates in a Laravel project. It provides several features for automatically formatting and organizing code within the blade templates. The plugin supports PHP 8 syntax and follows the PSR-2 coding standard. It also offers the option to automatically sort Tailwind CSS classes based on the configuration in tailwind.config.js.
Features:
- Automatically indent markup inside directives
- Automatically add spacing to blade template markers
- PHP 8 syntax support (null safe operator, named arguments)
- Compliant to PSR-2 coding standard (PHP code inside directives)
- Automatically sort Tailwind CSS classes with respect to tailwind.config.js
Installation:
To install the Prettier plugin for blade templates, you need to add it to your Prettier configuration. Follow the steps below:
Install the Prettier package version compatible with the plugin:
- Prettier 3.x: ^1.9.x
- Prettier 2.x: 1.8.x
Add the plugin to your Prettier configuration.
Summary:
The Prettier plugin for blade templates offers a convenient solution for formatting and organizing code within Laravel’s blade templates. It provides automatic indentation inside directives, adds spacing to blade template markers, and supports PHP 8 syntax. Additionally, it follows the PSR-2 coding standard and offers an option to sort Tailwind CSS classes based on the configuration in tailwind.config.js. This plugin is a valuable tool for developers working on Laravel projects, enhancing code readability and maintainability.