{"id":20340,"library":"prettier-plugin-blade","title":"prettier-plugin-blade","description":"An opinionated Prettier plugin for formatting Laravel Blade templates, currently at version 3.1.5 (stable). It requires Node.js >=18 and Prettier ^3.0, and optionally integrates with @prettier/plugin-php for embedded PHP formatting and prettier-plugin-tailwindcss for Tailwind CSS class sorting. Key differentiators include a ground-up rewrite in v3 with changed output, Blade syntax plugins for frameworks like Statamic, and extensive configuration options for directive spacing, echo spacing, component prefixes, and inline element behavior. Released frequently with bug fixes and improvements. Active development.","status":"active","version":"3.1.5","language":"javascript","source_language":"en","source_url":"https://github.com/fortephp/chisel","tags":["javascript","prettier","plugin","blade","laravel","formatter","typescript"],"install":[{"cmd":"npm install prettier-plugin-blade","lang":"bash","label":"npm"},{"cmd":"yarn add prettier-plugin-blade","lang":"bash","label":"yarn"},{"cmd":"pnpm add prettier-plugin-blade","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency: required to run the plugin","package":"prettier","optional":false},{"reason":"Optional: enables PHP formatting within Blade templates","package":"@prettier/plugin-php","optional":true},{"reason":"Optional: enables Tailwind CSS class sorting","package":"prettier-plugin-tailwindcss","optional":true}],"imports":[{"note":"This is a Prettier plugin, not imported directly in JS. Configure in .prettierrc or CLI.","wrong":"require('prettier-plugin-blade')","symbol":"plugin (in .prettierrc plugins array)","correct":"module.exports = { plugins: ['prettier-plugin-blade'] }"},{"note":"The parser string is just 'blade', not the file extension.","wrong":"{ parser: 'blade.php' }","symbol":"parser (blade)","correct":"{ parser: 'blade' }"},{"note":"Override must specify files matching Blade templates, e.g. ['*.blade.php'].","wrong":"{ parser: 'blade' } inside overrides without files array","symbol":"options (in .prettierrc)","correct":"module.exports = { plugins: ['prettier-plugin-blade'], overrides: [{ files: ['*.blade.php'], options: { parser: 'blade' } }] }"}],"quickstart":{"code":"module.exports = {\n  plugins: ['prettier-plugin-blade'],\n  overrides: [{\n    files: ['*.blade.php'],\n    options: { parser: 'blade', tabWidth: 4 }\n  }]\n};","lang":"javascript","description":"Basic .prettierrc configuration to format Blade templates with Prettier."},"warnings":[{"fix":"Pin to previous version (e.g., prettier-plugin-blade@^2) if you need stable output, or update your codebase to accommodate v3 formatting.","message":"Chisel v3 is a ground-up rewrite: output changes compared to v2.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Upgrade Prettier to v3: npm install prettier@^3 --save-dev","message":"Prettier v2 is not supported; requires Prettier ^3.0.0.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Ensure Node.js version is 18 or higher: node --version","message":"The plugin requires Node.js >=18.0.0; older versions will fail.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Install @prettier/plugin-php and add to plugins array in .prettierrc.","message":"When using PHP formatting (bladePhpFormatting: 'safe'), @prettier/plugin-php must be installed and in plugins list.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Use repeated flags for array values in CLI. Use JSON array in .prettierrc for ease.","message":"CLI array options must be repeated per item (e.g., --blade-component-prefixes x --blade-component-prefixes flux), not comma-separated.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Set bladeDirectiveCaseMap in .prettierrc instead of CLI to avoid shell quoting issues.","message":"bladeDirectiveCaseMap option is a JSON object; passing it via CLI requires careful quoting.","severity":"gotcha","affected_versions":">=3.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run npm install --save-dev prettier-plugin-blade","cause":"Plugin is not installed or not in node_modules","error":"Error: Cannot find module 'prettier-plugin-blade'"},{"fix":"Ensure plugin is in 'plugins' array and parser is 'blade'. Example: { plugins: ['prettier-plugin-blade'], parser: 'blade' }","cause":"Parser string is not 'blade' or plugin not loaded","error":"The 'parser' option is not recognized by Prettier"},{"fix":"Install @prettier/plugin-php: npm install --save-dev @prettier/plugin-php, or disable PHP formatting by setting bladePhpFormatting: 'off'","cause":"PHP formatting is enabled but optional plugin not installed","error":"Error: Cannot find module '@prettier/plugin-php'"},{"fix":"Upgrade Prettier to v3: npm install prettier@^3 --save-dev","cause":"Outdated version of Prettier (v2) incompatible with plugin v3","error":"TypeError: Cannot read properties of undefined (reading 'blade')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}