egg-onefile2
v1.0.5
Published
Alex.Zhang
Downloads
3
Readme
egg-onefile
This plugin will serve for dynamic file output.
Install
$ npm i egg-onefile2 --save
Usage
// {app_root}/config/plugin.js
exports.onefile = {
enable: true,
package: 'egg-onefile2',
};
Configuration
// {app_root}/config/config.default.js
exports.onefile = {
match(ctx) {
return ctx.url === '/';
},
headers: {
'Content-Type': 'text/html; charset=utf-8',
'Cache-Control': 'no-store',
},
replace: {
'${hello}': 'hello',
},
* before() {
// you can do something before
}
path: path.join(__dirname, '../app/public/index.html'),
};
see config/config.default.js for more detail.
Example
Questions & Suggestions
Please open an issue here.