Installations
npm install koa-ejs-remote
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
10.13.0
NPM Version
6.4.1
Score
64.9
Supply Chain
90.4
Quality
71.4
Maintenance
25
Vulnerability
97.6
License
Releases
Unable to fetch releases
Download Statistics
Total Downloads
27,756
Last Day
1
Last Week
8
Last Month
24
Last Year
309
Bundle Size
161.75 kB
Minified
49.20 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.1.6
Package Id
koa-ejs-remote@1.1.6
Unpacked Size
52.04 kB
Size
16.58 kB
File Count
20
NPM Version
6.4.1
Node Version
10.13.0
Total Downloads
Cumulative downloads
Total Downloads
27,756
Last day
0%
1
Compared to previous day
Last week
-20%
8
Compared to previous week
Last month
-4%
24
Compared to previous month
Last year
-54.9%
309
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
koa-ejs-remote
Koa ejs view render middleware, asynchronous load template(support view from remote host)
Usage
Example
1const Koa = require('koa'); 2const render = require('koa-ejs-remote'); 3const path = require('path'); 4 5const app = new Koa(); 6render(app, { 7 root: '/public', 8 host:'http://127.0.0.1:3000', 9 layout: 'template', 10 viewExt: 'html', 11 cache: false, 12 debug: true 13}); 14 15app.use(async function (ctx) { 16 await ctx.render('user'); 17}); 18 19app.listen(7001);
settings
- root: view root.
- host: remote host.
- layout: global layout file, default is
layout
, setfalse
to disable layout. - viewExt: view file extension (default
html
). - cache: cache compiled templates (default
true
). - debug: debug flag (default
false
). - delimiter: character to use with angle brackets for open / close (default
%
).
Layouts
koa-ejs-remote
supports layouts. The default layout file is layout
. If you want to change default layout file, use settings.layout
. Also you can specify layout by options.layout
in await ctx.render
.
Also you can set layout = false
to disable the layout.
<html>
<head>
<title>koa ejs</title>
</head>
<body>
<h3>koa ejs</h3>
<%- body %>
</body>
</html>
Include
Supports ejs includes.
<div>
<% include user.html %>
</div>
Licences
(The MIT License)
Copyright (c) 2017 dead-horse and other contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
No security vulnerabilities found.