storybook-addon-html icon indicating copy to clipboard operation
storybook-addon-html copied to clipboard

How to remove Lit HTML comments?

Open yannickoo opened this issue 3 years ago • 3 comments

When working with Lit components you will find HTML code like this ⬇️

<my-button>
  <!--?lit$7082895866$-->
  <!--?lit$7082895866$-->Primary Button
  <!--?lit$7082895866$-->
</my-button>

How should we support a way to remove those comments here?

Thanks 🤗

yannickoo avatar Dec 17 '21 23:12 yannickoo

i have the same problem this regex /g, not work regex

heihong avatar Jan 18 '22 15:01 heihong

Maybe we could this regex to get rid of every HTML comment no matter what's inside?

Screenshot 2022-01-19 at 00 58 26

I have created a PR for that change https://github.com/whitespace-se/storybook-addon-html/pull/66 🐣

yannickoo avatar Jan 18 '22 23:01 yannickoo

I think a regex or filter callback is the way to go. Me and the other developers at Whitespace are planning to do some maintenance (go through issues and merge PRs) this and next week. Thank you for your patience!

jeanfredrik avatar Sep 27 '22 08:09 jeanfredrik

It's now possible to define what comments to remove with the removeComments parameter and providing a regular expression. I hope it solves this issue for you!

jeanfredrik avatar Nov 12 '22 00:11 jeanfredrik