丝绒-评论-注射器
一个斯维尔特预处理器,它在每个组件的顶端注入一个HTML注释,使得在浏览器DevTools中更容易识别组件.
* 特性
- 注入 DevTools 可见的 HTML 注释, 如 :
<!-- Begin MyComponent.svelte --> <div class="my-component"> <!-- Component content --> </div> <!-- End MyComponent.svelte -->
* 安装
npm install @gitbutler/svelte-comment-injector --save-dev
使用量
在您的 Svelte 配置中添加预处理器 :
// svelte.config.js
import svelteInjectComment from "@gitbutler/svelte-comment-injector";
export default {
preprocess: [svelteInjectComment()],
// ...rest of your config
};
QQ 配置
您可以通过将选项传递到预处理器来自定义注释格式 :
// svelte.config.js
import svelteInjectComment from "@gitbutler/svelte-comment-injector";
export default {
preprocess: [
svelteInjectComment({
enabled: true, // Enable or disable the comment injection
showEndComment: true, // Show the end comment
showFullPath: false, // Show the full path in the comment
}),
],
// ...rest of your config
};