Installations
npm install egg-view-ejs
Releases
Unable to fetch releases
Developer
eggjs
Developer Guide
Module System
Unable to determine the module system for this package.
Min. Node Version
>=14.0.0
Typescript Support
No
Node Version
16.14.2
NPM Version
6.14.16
Statistics
64 Stars
19 Commits
10 Forks
12 Watching
3 Branches
25 Contributors
Updated on 03 Jul 2024
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
355,085
Last day
-4.5%
169
Compared to previous day
Last week
-18.1%
1,277
Compared to previous week
Last month
17.6%
5,731
Compared to previous month
Last year
-6.2%
68,547
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
egg-view-ejs
egg view plugin for ejs.
Install
1$ npm i egg-view-ejs --save
Usage
1// {app_root}/config/plugin.js 2exports.ejs = { 3 enable: true, 4 package: 'egg-view-ejs', 5}; 6 7// {app_root}/config/config.default.js 8exports.view = { 9 mapping: { 10 '.ejs': 'ejs', 11 }, 12};
Create a ejs file
1// app/view/hello.ejs 2hello <%= data %>
Render it
1// app/controller/render.js 2exports.ejs = async ctx => { 3 await ctx.render('hello.ejs', { 4 data: 'world', 5 }); 6};
The file will be compiled and cached, you can change config.ejs.cache = false
to disable cache, it's disable in local env by default.
Include
You can include both relative and absolute file.
Relative file is resolve from current file path.
1// app/view/a.ejs include app/view/b.ejs 2<% include('b.ejs') %>
Absolute file is resolve from app/view
.
1// app/view/home.ejs include app/view/partial/menu.ejs 2<% include('/partial/menu.ejs') %>
Layout
You can render a view with layout also:
1// app/view/layout.ejs 2 3<% body %> 4 5// app/controller/render.js 6exports.ejs = async ctx => { 7 const locals = { 8 data: 'world', 9 }; 10 11 const viewOptions = { 12 layout: 'layout.ejs' 13 }; 14 15 await ctx.render('hello.ejs', locals, viewOptions); 16};
Configuration
see config/config.default.js for more detail.
Questions & Suggestions
Please open an issue here.
License
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 10/18 approved changesets -- score normalized to 5
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:30: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-view-ejs/nodejs.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-view-ejs/nodejs.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/nodejs.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/eggjs/egg-view-ejs/nodejs.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/nodejs.yml:39
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 third-party GitHubAction dependencies pinned
- Info: 1 out of 2 npmCommand dependencies pinned
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 12 are checked with a SAST tool
Score
4.5
/10
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More