1、VSCode 安装prettier

2、文件——首选项——设置###

在工作区搜索format,在文本编辑器中选中在保存时格式化文件,之后就会在项目根目录下生成.vscode文件(用户和工作区的区别是用户设置后会在所有项目中应用该设置。而工作区是只在当前项目中生效。
)
3、在项目根目录中新建.prettierrc文件
printWidth: 100,
semi: true,
vueIndentScriptAndStyle: true,
singleQuote: true,
trailingComma: 'all',
proseWrap: 'never',
htmlWhitespaceSensitivity: 'strict',
endOfLine: 'auto',
4、在项目根目录下新建.prettierignore文件###
/dist/*
.local
.output.js
/node_modules/**
**/*.svg
**/*.sh
/public/*
5、prettier 学习###


网友评论