express-polyfill-service
v0.0.1
Published
Express middleware for polyfill-service
Downloads
3
Maintainers
Readme
Express Polyfill Service
An express middleware for Polyfill Service by Financial-Times
Installation
npm install express-polyfill-service --save
Usage
var polyfill = require('express-polyfill-service');
app.use('/polyfill.js', polyfill());
<script type="application/javascript" src="/polyfill.js"></script>
API
app.use('/polyfill.js', polyfill([options]));
options
is a javascript object with the following properties:
These are the default properties passed directly to getPolyfillString
uaString
: String, required. The user agent to evaluate for polyfills that should be included conditionallyminify
: Boolean, optional. Whether to minify the bundlefeatures
: Object, optional. An object with the features that are to be considered for polyfill inclusion. If not supplied, no features will be considered and the output will be blank. To load the default feature set, set features to{default:{}}
. Each feature must be an entry in the features object with the key corresponding to the name of the feature and the value an object with the following properties:flags
: Array, optional. Array of flags to apply to this feature (see below)unknown
: String, optional. What to do when the user agent is not recognised. Set topolyfill
to return default polyfill variants of all qualifying features,ignore
to return nothing. Defaults toignore
.
Flags that may be applied to polyfills are:
gated
: Wrap this polyfill in a feature-detect, to avoid overwriting the native implementationalways
: Include this polyfill regardless of the user-agent