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

Fix template parts inside comments #75

Merged
merged 1 commit into from
Feb 11, 2019
Merged

Fix template parts inside comments #75

merged 1 commit into from
Feb 11, 2019

Conversation

goto-bus-stop
Copy link
Member

@goto-bus-stop goto-bus-stop commented Feb 11, 2019

Comment state is preserved when entering a template ${embed} part,
so you can do things like

html`
  <div>
    <!-- ${someElementThatIWantHidden()} -->
    ${someElementThatIWantShown()}
  </div>
`

instead of the somewhat clumsy

html`
  <div>
    ${''/*
      someElementThatIWantHidden()
    */}
  </div>
`

Of course, in the first situation, someElementThatIWantHidden() is still evaluated, just not inserted.

With opts.comments = true, the embedded parts are stringified and concatenated.

index.js Show resolved Hide resolved
index.js Show resolved Hide resolved
@goto-bus-stop goto-bus-stop merged commit 75d0b5b into master Feb 11, 2019
@delete-merged-branch delete-merged-branch bot deleted the comment branch February 11, 2019 19:05
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

Successfully merging this pull request may close these issues.

2 participants