@ glimmerx/ pretier- plugin- 组件- templades
背景情况
高级 是一个有观点的代码。 在预告片 >2.0 有支持 *.hbs 闪光文件,但不支持实验语法 glimmerx 组件被写入.
导言
此插件将内部打印机扩展为在闪光模板中添加嵌入式语法 hbs 标记图示 .
安装和使用
yarn add -D @glimmerx/prettier-plugin-component-templates
一旦添加更美,将发现并使用插件格式化任何 hbs 标记模板表达式 .
选项
在您的更漂亮的配置选项中( 例如 ) . .prettierrc, (中文(简体) ), prettier.config.js页:1
.prettierrc
{
"hbsSingleQuote": true
}
默认为 false 对嵌入于 hbs 中的所有属性强制双引号 。 何时 true 将所有引用重写为单引号.
发展
生成一个测试案例, 添加到测试文件中,
添加 PRETTIER_DEBUG=true 在运行插件时向环境移动,以获取错误的完整堆栈痕迹.
调试
调试
PRETTIER_DEBUG=true node --inspect-brk node_modules/.bin/prettier --config=./test/fixtures/basic/config.js ./test/fixtures/basic/code.js
生成快照
node node_modules/.bin/prettier --ignore-path --config=./test/fixtures/simple-formatted/config.js ./test/fixtures/simple-formatted/code.js > ./test/fixtures/simple-formatted/output.js
测试
运行所有测试
yarn test
开始
- 添加对支持
<template>标记语义.