1.1.1 • Published 4 years ago
ejs-prerender v1.1.1
ejs-prerender
Usage
This package is typically used as a devDependency. Install by running npm i -D ejs-prerender. It can be used as an npm script like the following:
"build:templates": "ejs-prerender",and run manually using npx:
npx ejs-prerenderThis package utilizes the debug library, so adding DEBUG=ejs-prerender:* to a .env file or the command path (DEBUG=ejs-prerender:* npx ejs-prerender) will enable logging of everything.
Recommended File Structure
The following file structure works out-of-the-box with no customized environment variables.
root
├ components/
│ └ head.ejs
└ pages/
├ about/
│ └ index.ejs
└ index.ejswill render as
root
└ public/
├ about/
│ └ index.html
└ index.htmlThe components can be simply referenced inside EJS pages as seen below:
<!DOCTYPE html>
<html>
<head>
<%- include('head') -%>
</head>
<body><h1>INDEX</h1></body>
</html>Configuration
Environment Variables
| Option | Environment Variable | Type | Default | Description |
|---|---|---|---|---|
| baseDir | PEJS_BASE_DIR | String | current working directory | Base directory to reference for other relative paths |
| outputDir | PEJS_BUILD_OUTPUT_DIR | String | 'public' | Where the completed pages get written |
| componentsDir | PEJS_BUILD_COMPONENTS_DIR | String | 'components' | Where components live |
| pagesDir | PEJS_BUILD_PAGES_DIR | String | 'pages' | Where pages live |
| pageExtension | PEJS_BUILD_PAGES_EXT | String | 'ejs' | File extension of pages |
1.1.1
4 years ago
1.1.0
5 years ago
1.1.0-beta.1
6 years ago
1.1.0-beta.0
6 years ago
1.0.4-beta.1
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago
1.0.3
6 years ago
0.1.0
6 years ago