Foreword
EJS, "E" on behalf of "effective", that is, [efficient], EJS is a simple JavaScript templates, EJS is not how to organize the content of dogma; nor a re-iterative control flow and syntax; some just plain JavaScript code nothing!
Can be achieved using ejs rear distal interaction only to generate an HTML page with a simple javascript code, it is generally used to express and used together.
ejs- non-destructive, non-invasive, low-dependent (and normal html can coexist and css) files ending .ejs
Learn more about
- Pure JavaScript
- Rapid Development
- The syntax is simple
- Rapid implementation
We all know how fast V8 JavaScript engine speed and the like. EJS intermediate code can be cached JS function, so as to enhance execution speed
- Easy to debug
EJS debugging errors (error) is easy: all errors are common JavaScript exception and can output where the exception happened.
characteristic
-
Quick compiled and rendered output
-
Simple template tag: <%%>
-
Custom delimiter (eg: Replace <%> <??>)
-
The introduction of template fragments
-
Supports server (node) and the browser environment JS
-
JavaScript static cache intermediate results
-
Template static cache
-
Compatible Express view system
installation
Method a: install by npm
As in the package depends on the local node are used to install
npm install ejs
Method two: by introducing js
Js incorporated as introduced in html
<script src="ejs.js"></script>
working principle