File tree Expand file tree Collapse file tree 1 file changed +30
-8
lines changed
Expand file tree Collapse file tree 1 file changed +30
-8
lines changed Original file line number Diff line number Diff line change 44
55Simply install ` prettier ` and ` @prettier/plugin-pug ` as your project’s npm ` devDependencies ` :
66
7- ``` bash
7+ ::: code-group
8+
9+ ``` shell [npm]
810npm add --save-dev prettier @prettier/plugin-pug
9- yarn add --dev prettier @prettier/plugin-pug
11+ ```
12+
13+ ``` shell [pnpm]
1014pnpm add --save-dev prettier @prettier/plugin-pug
1115```
1216
17+ ``` shell [yarn]
18+ yarn add --dev prettier @prettier/plugin-pug
19+ ```
20+
21+ :::
22+
1323## Usage
1424
1525Format all pug files in your project:
1626
17- ``` bash
27+ ::: code-group
28+
29+ ``` shell [npm]
1830npx prettier --write " **/*.pug"
19- yarn prettier --write " **/*.pug"
31+ ```
32+
33+ ``` shell [pnpm]
2034pnpm prettier --write " **/*.pug"
2135```
2236
37+ ``` shell [yarn]
38+ yarn prettier --write " **/*.pug"
39+ ```
40+
41+ :::
42+
2343### Selectively ignoring automatic formatting
2444
2545You can disable code formatting for a particular element by adding ` //- prettier-ignore ` comments in your pug templates:
2646
27- ``` pug
47+ ::: code-group
48+
49+ ``` pug [Input]
2850div.text( color = "primary", disabled ="true" )
2951//- prettier-ignore
3052div.text( color = "primary", disabled ="true" )
3355 div.text( color = "primary", disabled ="true" )
3456```
3557
36- Prettified output:
37-
38- ``` pug
58+ ``` pug [Output]
3959.text(color="primary", disabled)
4060//- prettier-ignore
4161div.text( color = "primary", disabled ="true" )
4464 div.text( color = "primary", disabled ="true" )
4565```
4666
67+ :::
68+
4769You can also disable code formatting in Markdown for a particular ` ```pug ` block by adding` <!-- prettier-ignore --> ` before the block:
4870
4971```` markdown
You can’t perform that action at this time.
0 commit comments