serhii.net

In the middle of the desert you can say anything you want

18 Jun 2024

EJS comments

All from javascript - How can I comment the EJS code (JS node) without getting an error - Stack Overflow:



// Neat multiline comment thing
<%if(false) {%>  
  <!-- single row of inline icons for pdf. etc instead of buttons -->
<%} %>

// hard to grep for and no syntax highlight, so maybea adding COMMENT works as my bad idea
<%if(false) {%>  
  <!-- COMMENT 
	single row of inline icons for pdf. etc instead of buttons 
  -->

// Documentation says: 
<%# comment %> 


// Not documentation, multiline comment:
<%/* comment */%> 

I had issues putting HTML code w/ EJS snippets in the latter one, so iffalse it is. For nested things, SO suggests these (both bad imo):

<!--label for="<%#= user.id %>" style="background-color: <%#= user.color %>;"-->
<!--label for= <%#=`${user.id}` %> style= <%#=`background-color: ${user.color};`%> -->
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus