Run npm install -D prettier prettier-plugin-antlers prettier-plugin-blade prettier-plugin-tailwindcss
in your terminal
Create a .prettierrc
file with the following content
{
"singleQuote": true,
"printWidth": 140,
"tabWidth": 4,
"plugins": [
"prettier-plugin-antlers",
"prettier-plugin-blade",
"prettier-plugin-tailwindcss"
],
"tailwindStylesheet": "./resources/css/site.css",
"overrides": [
{
"files": "*.antlers.html",
"options": {
"parser": "antlers",
"singleQuote": false
}
},
{
"files": "*.blade.php",
"options": {
"parser": "blade",
"singleQuote": false
}
},
{
"files": [
"**/*.css",
"**/*.html"
],
"options": {
"singleQuote": false
}
},
{
"files": [
"**/*.yaml",
"**/*.yml"
],
"options": {
"singleQuote": false,
"tabWidth": 2
}
}
]
}
Create a .prettierignore
file with the following content
**/*.md
**/*.yaml
Under Settings | Languages & Frameworks | JavaScript | Prettier
- Choose
Automatic Prettier configuration
- Add the this pattern for
Run for Files
:**/*.{js,ts,jsx,tsx,cjs,cts,mjs,mts,vue,blade.php,antlers.html,css}
- Tick the boxes for
Run on save
Prefer Prettier configuration to IDE code style
- Under
Settings | PHP | Quality Tools
, enableLaravel Pint
as External Formatter - Under
Settings | PHP | Quality Tools | Laravel Pint
, enable Pint - Under
Settings | Tools | Actions on Save
- Enable
Reformat code
- Exclude the file types
Antlers
,Blade
,Markdown
, andYaml
- Enable
- Make sure a Node interpreter is selected under
Settings > Language & Frameworks > Node.js