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

a tag for template literals #365

Open
5im-0n opened this issue May 3, 2018 · 1 comment
Open

a tag for template literals #365

5im-0n opened this issue May 3, 2018 · 1 comment

Comments

@5im-0n
Copy link
Contributor

5im-0n commented May 3, 2018

I use ejs a lot in the browser only, and it would be really cool if we could use template strings to store ejs templates.
Something like

var name = 'Simon';
var html = ejs`
<div>
  <p><%= name %></p>
</div>
`;

Editors like vscode could then be extended to support syntax highlighting to ejs template literals like lit-html does.

@5im-0n
Copy link
Contributor Author

5im-0n commented May 3, 2018

I made an example of how this could work:
https://github.com/S2-/ejs/blob/template-literal/examples/client-template-literals.html#L31

Using template literals there would be no need to make <script type="text/ejs"> elements in html, and it would come in handy when making js libraries that have templates inside them and are shipped without having a server side component.

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

1 participant