Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow use of comment instead of tag #27

Open
trevorhreed opened this issue Dec 12, 2018 · 4 comments
Open

Allow use of comment instead of tag #27

trevorhreed opened this issue Dec 12, 2018 · 4 comments

Comments

@trevorhreed
Copy link

Sometimes using a tag to trigger the benefits of this plugin on a template string isn't feasible, and it would be nice to be able to substitute a comment instead. For example, instead of doing this:

var template = html`
  <h1>Hello World!</h1>
`

...it would be nice to be able to do this:

var template = /*html*/`
  <h1>Hello World</h1>
`
@aubricus
Copy link

aubricus commented Jan 16, 2019

For VS Code this exact syntax is available and doesn't require any additional imports: https://marketplace.visualstudio.com/items?itemName=Tobermory.es6-string-html

This may also be applicable to #4 as well.

@felipecrs
Copy link

felipecrs commented Mar 3, 2021

This would solve mjbvz/vscode-lit-html#14. Any tips for the implementation? It would be good if we could expose the regex as a configuration.

@chase-moskal
Copy link

but i want to understand why a comment be desirable over of using a dummy-noop html tag function?

using a noop has the advantages of (a) already working, and (b) making for a good point of refactorability, ie, validation or santization

what motivates you to prefer a comment for this purpose?

@rdmurphy
Copy link

Just wanted to throw a +1 on this — I've been using that es6-string-html plugin and it works fine visually, but it doesn't implement the wonderful IntelliSense support and other things that this plugin has. Sometimes I'm just throwing some stringified HTML into a <template> via JS and would love to have this stuff come along with it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants