Home  >  Article  >  Web Front-end  >  Summary of common grammar of ejs

Summary of common grammar of ejs

巴扎黑
巴扎黑Original
2017-07-21 17:47:191790browse

There are many template engines for nodejs, and ejs is relatively simple and easy to use. Some commonly used syntax:

  • Use <%...%> to include js code

  • Use <%=... %>Output variable If the variable contains characters such as '<' '>' '&', it will be escaped

  • Use <%-...%> to output the variable Without escaping

  • Use <%- include('user/show') %> to introduce other templates Include ./user/show.ejs

  • Use <%# some comments %> to comment, no execution or output

  • <%% is escaped as '<% '

  • ##<% ... -%> Remove new blank line pattern?

  • <%_ ... _ %> Remove whitespace pattern

The above is the detailed content of Summary of common grammar of ejs. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn