Gathering detailed insights and metrics for koa-manifest-rev
Gathering detailed insights and metrics for koa-manifest-rev
Gathering detailed insights and metrics for koa-manifest-rev
Gathering detailed insights and metrics for koa-manifest-rev
npm install koa-manifest-rev
Typescript
Module System
Min. Node Version
Node Version
NPM Version
66.4
Supply Chain
98.6
Quality
77.7
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
5,945
Last Day
1
Last Week
1
Last Month
29
Last Year
386
3 Stars
3 Commits
1 Watching
2 Branches
4 Contributors
Latest Version
0.3.0
Package Id
koa-manifest-rev@0.3.0
Size
53.65 kB
NPM Version
5.3.0
Node Version
8.3.0
Cumulative downloads
Total Downloads
Last day
-83.3%
1
Compared to previous day
Last week
-93.3%
1
Compared to previous week
Last month
-34.1%
29
Compared to previous month
Last year
67.1%
386
Compared to previous year
Dynamically load assets into your views from your
rev-manifest.json
manifest revision file (e.g.<script src="{{ manifest('foo.js'); }}"></script>
returns<script src="/foo-0775041dd4.js"></script>
when rendered).Works with any templating engine, such as pug, ejs, or nunjucks. Inspired by express-rev and built for koa.
npm:
1npm install koa-manifest-rev
yarn:
1yarn add koa-manifest-rev
Require the package and include the middleware
1import Koa from 'koa'; 2import koaManifestRev from 'koa-manifest-rev'; 3import path from 'path'; 4 5const app = new Koa(); 6 7app.use(koaManifestRev({ 8 manifest: path.join(__dirname, 'build', 'rev-manifest.json'), 9 prepend: '/' 10}));
Call the manifest(str)
helper function in your views when you need to include assets (requires a templating engine).
pug:
1html 2 head 3 title Foo 4 body 5 h1 Foo 6 script(src=manifest('foo.js'))
1<html> 2 <head> 3 <title>Foo</title> 4 </head> 5 <body> 6 <h1>Foo</h1> 7 <script src="<%= manifest('foo.js'); %>"></script> 8 </body> 9</html>
nunjucks (via koa-nunjucks-promise):
1<html> 2 <head> 3 <title>Foo</title> 4 </head> 5 <body> 6 <h1>Foo</h1> 7 <script src="{{ manifest('foo.js'); }}"></script> 8 </body> 9</html>
koaManifestRev(options)
- accepts a required options
argument for setup. Returns middleware for use in app.use
statement (which in turn binds to ctx.state
a helper function called manifest
). Here are the properties accepts in the options
argument.
manifest
(required) - path to a valid rev-manifest.json
file (e.g. as built by gulp-rev or gulp-rev-all)prepend
(optional) - string to prepend before file paths rendered after lookup (e.g. if you type {{ manifest('foo.js'); }}
in your view, and you have passed prepend: '/dist/'
in your setup, then your tag would render as <script src="/dist/foo-0775041dd4.js"></script>
(defaults to /
)manifest(str)
- the helper function bound to ctx.state
when koaManifestRev
middleware is included in your app. Returns the string found from a lookup in your rev-manifest.json
file for the str
argument passed (e.g. if you type {{ manifest('foo.js'); }}
in your view, then it returns for the value of the foo.js
property as defined in your manifest
file, such as foo-0775041dd4.js
). If the found is not found, then the input str
argument is returned.
Name | Website |
---|---|
Nick Baugh | http://niftylettuce.com/ |
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/3 approved changesets -- score normalized to 0
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
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
75 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-23
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