More Premium Hugo Themes Premium Tailwind Themes

Prettier Plugin Blade

Format your blade template using Prettier

Prettier Plugin Blade

Format your blade template using Prettier

Author Avatar Theme by shufo
Github Stars Github Stars: 358
Last Commit Last Commit: Feb 8, 2025 -
First Commit Created: Dec 18, 2023 -
default image

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:

  1. Install the Prettier package version compatible with the plugin:

    • Prettier 3.x: ^1.9.x
    • Prettier 2.x: 1.8.x
  2. 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.