reading-notes2

https://m7madmomani2.github.io/reading-notes2

View the Project on GitHub M7madMomani2/reading-notes2

EJS

Image

What is EJS?

  • What is the “E” for? “Embedded?” Could be. How about “Effective,” “Elegant,” or just “Easy”? EJS is a simple templating language that lets you generate HTML markup with plain JavaScript. No religiousness about how to organize things. No reinvention of iteration and control-flow. It’s just plain JavaScript.

EJS advantage:-

  • Use plain JavaScript.
  • Fast development time
  • Simple syntax
  • Speedy execution
  • Easy debugging
  • Active development

Image

Tags:-

  • <% ‘Scriptlet’ tag, for control-flow, no output.
  • <%_ ‘Whitespace Slurping’ Scriptlet tag, strips all whitespace before it.
  • <%= Outputs the value into the template (HTML escaped).
  • <%- Outputs the unescaped value into the template.
  • <%# Comment tag, no execution, no output.
  • <%% Outputs a literal ‘<%’.
  • %> Plain ending tag.
  • -%> Trim-mode (‘newline slurp’) tag, trims following newline.
  • _%> ‘Whitespace Slurping’ ending tag, removes all whitespace after it.