Introduction
Plugins
Chisel supports Blade syntax plugins through the bladeSyntaxPlugins option.
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
- directive PHP-formatting wrappers for package-specific directive arguments
#Configuration
#.prettierrc
Use built-in plugin options in JSON/YAML config files:
{
"plugins": [
"prettier-plugin-blade",
"@prettier/plugin-php"
],
"overrides": [
{
"files": ["*.blade.php"],
"options": {
"parser": "blade",
"bladePhpFormatting": "safe",
"bladeSyntaxPlugins": [
"statamic",
"log1x/sage-directives"
]
}
}
]
}
#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 \
--blade-syntax-plugins log1x/sage-directives
Comma-separated string entries are also accepted internally, but repeated flags are clearer in CLI usage.
#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",
"log1x/sage-directives"
],
},
},
],
};
#Built-In Plugins
Chisel currently includes the following built-in plugins:
| Plugin | Description |
|---|---|
statamic |
Improves support for custom Statamic Blade directives. |
log1x/sage-directives |
Provides support for https://github.com/Log1x/sage-directives directives. |