Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
248 views
in Technique[技术] by (71.8m points)

How do I stop prettier from formatting HTML files?

So the problem is that prettier does not format html very well.

for instance if I have this angular template:

<some-component
  some-attribute 
  [ang-binding1]='someExpr'
  [ang-binding2]='someExpr'
  (someEvent)='someFunc($event)'>
</some-component>

prettier will format it to something like this:

<some-component some-attribute [ang-binding1]='someExpr' [ang-binding2]='someExpr' (someEvent)='someFunc($event)'>
</some-component>

how do I disable prettier formating for html templates ?

question from:https://stackoverflow.com/questions/50261161/how-do-i-stop-prettier-from-formatting-html-files

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you are using VS Code, you can prevent Prettier from running on HTML (or other specific languages) by adding the following to your settings:

"prettier.disableLanguages": ["html"]

You can find other VS Code specific options at the prettier/prettier-vscode GitHub page.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...