Introduction
Plugins
Chisel supports its built-in Blade syntax profiles through the
bladeSyntaxPlugins option. Chisel currently ships a statamic profile.
These plugins extend the parser and formatter with framework-specific or package-specific Blade behavior without changing the base formatter for every project.
#What bladeSyntaxPlugins Does
Syntax plugins can contribute:
- extra directive names for parsing
- directive pairing metadata for block directives
- verbatim-style directive regions
#Configuration
#.prettierrc
Use built-in plugin names in JSON or YAML config files:
{
"plugins": [
"prettier-plugin-blade",
"@prettier/plugin-php"
],
"overrides": [
{
"files": ["*.blade.php"],
"options": {
"parser": "blade",
"bladePhpFormatting": "safe",
"bladeSyntaxPlugins": ["statamic"]
}
}
]
}
#CLI
Repeat the flag for each plugin:
npx prettier "resources/views/**/*.blade.php" \
--write \
--plugin prettier-plugin-blade \
--plugin @prettier/plugin-php \
--parser blade \
--blade-syntax-plugins statamic
The CLI also accepts comma-separated plugin names, but repeated flags avoid shell-dependent quoting and show each plugin boundary explicitly.
#JavaScript Config
Use the same built-in plugin tokens in JavaScript config files:
/** @type {import("prettier").Config} */
export default {
plugins: ["prettier-plugin-blade", "@prettier/plugin-php"],
overrides: [
{
files: ["*.blade.php"],
options: {
parser: "blade",
bladePhpFormatting: "safe",
bladeSyntaxPlugins: ["statamic"],
},
},
],
};
#Built-In Plugins
Chisel currently includes the following built-in syntax profile:
| Plugin | Description |
|---|---|
statamic |
Improves support for custom Statamic Blade directives. |
Names that do not match a built-in profile are ignored.