Summary of common grammar of ejs

巴扎黑
Release: 2017-07-21 17:47:19
Original
1768 people have browsed it

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!