Installations
npm install web-es6-templates
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
6.11.2
NPM Version
5.5.1
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
abovebored
Download Statistics
Total Downloads
5,475
Last Day
1
Last Week
7
Last Month
22
Last Year
359
GitHub Statistics
55 Commits
1 Forks
1 Watching
1 Branches
2 Contributors
Bundle Size
6.29 kB
Minified
2.68 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.1.6
Package Id
web-es6-templates@1.1.6
Unpacked Size
16.67 kB
Size
6.07 kB
File Count
15
NPM Version
5.5.1
Node Version
6.11.2
Total Downloads
Cumulative downloads
Total Downloads
5,475
Last day
0%
1
Compared to previous day
Last week
-36.4%
7
Compared to previous week
Last month
83.3%
22
Compared to previous month
Last year
-6.5%
359
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
ES6 template engine interface
This module allows native ES6 template literals to be used with DADI Web.
Installation
-
Add this module as a dependency:
npm install web-es6-templates --save
-
Include it in the
engines
array passed to Web:1require('@dadi/web')({ 2 engines: [ 3 require('web-es6-templates') 4 ] 5})
Usage
Config
You can change the folder where your helpers are stored in your config.xxx.json
file:
1 "engines": { 2 "es6": { 3 "paths": { 4 "helpers": "site/helpers" 5 } 6 } 7 }
Helpers
The base directory for absolute paths is the utils/helpers
directory.
Helpers are required()
functions that can be embeded into templates to keep your code DRY. Take this example which could live in your helpers
folder as slugify.js
.
1var s = require('underscore.string/slugify') 2 3module.exports.slugify = (chunk) => { 4 return s(chunk) 5}
This function would be used in a template file like so:
1${slugify('The Quick Brown Fox Jumps Over The Lazy Dog')}
Output:
the-quick-brown-fox-jumps-over-the-lazy-dog
Includes
The base directory for absolute paths is the pages/
directory. Take the following directory tree.
pages/
|_ partials/
|_ |_ header.js
|_ |_ footer.js
|_ index.js
|_ index.json
To include the partials from index.js
, you can use an underscore to indicate a sub-folder:
1${partials_header} 2 3<h1>ES6 Templates test</h1> 4 5<p>This page lives at ${host}.</p> 6 7<h2>Loop test</h2> 8 9<ul> 10 ${posts.results.map(i => `<li>${i.attributes.title}</li>`).join('')} 11</ul> 12 13${partials_footer}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 3/27 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
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
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 6 are checked with a SAST tool
Score
2.7
/10
Last Scanned on 2025-01-27
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