prettier-plugin-askama-temp.../README.md

41 lines
915 B
Markdown
Raw Normal View History

2023-08-19 18:27:59 +03:00
# prettier-plugin-askama-template
[prettier-plugin-jinja-template](https://github.com/davidodenwald/prettier-plugin-jinja-template) but with patches to work with Askama.
2022-11-18 22:05:06 +03:00
## Install
```bash
2023-08-22 15:51:18 +03:00
npm install --save-dev prettier https://git.fetbuk.ru/WerySkok/-/packages/npm/prettier-plugin-askama-template/1.0.0/files/2
2022-11-18 22:05:06 +03:00
```
Add the plugin to your `.prettierrc`:
```json
{
2023-08-19 18:27:59 +03:00
"plugins": ["prettier-plugin-askama-template"]
}
```
2022-11-18 22:05:06 +03:00
## Use
2023-01-06 20:32:30 +03:00
To format basic .html files, you'll have to override the used parser inside your `.prettierrc`:
2022-11-18 22:05:06 +03:00
```json
{
2022-11-18 23:22:28 +03:00
"overrides": [
{
"files": ["*.html"],
"options": {
2023-08-19 18:27:59 +03:00
"parser": "askama-template"
2022-11-18 23:22:28 +03:00
}
}
]
2022-11-18 22:05:06 +03:00
}
```
2023-01-06 20:32:30 +03:00
Run it on all html files in your project:
```bash
npx prettier --write **/*.html
```
If you don't have a prettier config you can run the plugin with this command:
```bash
2023-08-19 18:27:59 +03:00
npx prettier --write **/*.html --plugin=prettier-plugin-askama-template
2023-01-06 20:32:30 +03:00
```