1.0.10 • Published 8 years ago

egg-onefile v1.0.10

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

egg-onefile

NPM version build status Test coverage David deps Known Vulnerabilities npm download

This plugin will serve for dynamic file output.

Install

$ npm i egg-onefile --save

Usage

// {app_root}/config/plugin.js
exports.onefile = {
  enable: true,
  package: 'egg-onefile',
};

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.

License

MIT

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago