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

Add an Output function (like EJS's outputFunctionName) #284

Open
paul-norman opened this issue Apr 21, 2024 · 1 comment
Open

Add an Output function (like EJS's outputFunctionName) #284

paul-norman opened this issue Apr 21, 2024 · 1 comment

Comments

@paul-norman
Copy link

Is your feature request related to a problem? Please describe.

Often I'd like the ability to output code from a function rather than having to close / open the tags to do this. In EJS this is possible via the outputFunctionName option.

In short, I'd like to be able to write something like:

<% if (condition) { print(`string ${variable} string`) } %>

rather than:

<% if (condition) { %>string <%= variable %> string<% } %>
// or, more likely:
<% if (condition) { -%> string <%= variable %> string <%- } %>

Describe the solution you'd like

Either a function, or the documentation to make a function, that will allow me to output directly without opening and closing tags excessively. My IDE (WebStorm) doesn't support ETA with customised tags at all (I like <? / ?>), and provides terrible EJS support too, so I'm basically looking at monocoloured code files and find the first form far more familiar to me (and easier to type).

Describe alternatives you've considered

Opening and closing tags a lot! This is very annoying when refactoring EJS code that could take advantage of the outputFunctionName

@nebrelbug
Copy link
Collaborator

@paul-norman I like this idea. If anyone wants to contribute a PR, let's call the output function output by default.

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

2 participants