https://github.com/redhog/eejs
https://github.com/redhog/eejs
Last synced: over 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/redhog/eejs
- Owner: redhog
- License: apache-2.0
- Created: 2015-06-16T23:48:33.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-06-24T18:35:19.000Z (about 11 years ago)
- Last Synced: 2025-02-12T07:54:06.453Z (over 1 year ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# eejs
Extensible Embedded Javascript is a template inheritance system for the [EJS templating language](http://www.embeddedjs.com/). It provides blocks and template inheritance similar to what's available in Django templates.
EEJS supports all EJS syntax, and adds syntax for template inheritance and for defining nested overrideable blocks.
Basic example:
var rendered_text = require("eejs").require("./examples/foo.ejs")
examples/foo.ejs:
<% e.inherit("./bar.ejs"); %>
<% e.begin_define_block("foo"); %>
YY
<% e.super(); %>
ZZ
<% e.end_define_block(); %>
examples/bar.ejs:
a
<% e.begin_block("bar"); %>
A
<% e.begin_block("foo"); %>
XX
<% e.end_block(); %>
B
<% e.end_block(); %>
b
Output:
a
A
YY
XX
ZZ
B
b