-
Notifications
You must be signed in to change notification settings - Fork 842
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
29b076c
commit cabe314
Showing
5 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div>body</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div>footer</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
<div> | ||
<%-include('./layout.ejs', { | ||
body: include('./body.ejs'), | ||
footer: include('./footer.ejs') | ||
})%> | ||
</div> | ||
|
||
<hr> | ||
|
||
<div> | ||
<%-include('./layout.ejs', { | ||
footer: include('./footer.ejs') | ||
})%> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Advanced use of "include", fast layout, and dynamic rendering components. | ||
*/ | ||
|
||
var ejs = require('../../lib/ejs'); | ||
var read = require('fs').readFileSync; | ||
var join = require('path').join; | ||
var path = join(__dirname, '/index.ejs'); | ||
|
||
var ret = ejs.compile(read(path, 'utf8'), {filename: path})({title: 'use slot'}); | ||
|
||
console.log(ret); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>layout</title> | ||
</head> | ||
|
||
<body> | ||
<div> | ||
<h2><%=title%></h2> | ||
|
||
<% if (typeof body !== 'undefined') { %> | ||
<%- body %> | ||
<% } else { %> | ||
<p>This is the default body content.</p> | ||
<% } %> | ||
|
||
<div>description</div> | ||
|
||
<%- footer %> | ||
</div> | ||
|
||
</body> | ||
|
||
</html> |