Permalink
Browse files

docs: update readme (#6)

  • Loading branch information...
popomore committed Mar 15, 2018
1 parent 448a00e commit e369e2c924bb09e949f27e5095c29d7bcddda68a
Showing with 57 additions and 108 deletions.
  1. +19 −11 README.md
  2. +0 −76 README.zh_CN.md
  3. +33 −19 config/config.default.js
  4. +5 −2 package.json
@@ -20,9 +20,7 @@
[download-image]: https://img.shields.io/npm/dm/egg-view-assets.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-view-assets

<!--
Description here.
-->
Manage frontend assets in development and production.

## Install

@@ -32,27 +30,35 @@ $ npm i egg-view-assets --save

## Usage

Add `egg-view-assets` as plugin

```js
// {app_root}/config/plugin.js
exports.viewAssets = {
exports.assets = {
enable: true,
package: 'egg-view-assets',
};
```

## Configuration
Configuration, you can see full example in [egg-ant-design-pro].

```js
// {app_root}/config/config.default.js
exports.viewAssets = {
exports.view = {
mapping: {
'.js': 'assets',
},
};
```

see [config/config.default.js](config/config.default.js) for more detail.
## Example
exports.assets = {
devServer: {
command: 'roadhog dev',
port: 8000,
},
};
```

<!-- example here -->
See [config/config.default.js](config/config.default.js) for more detail.

## Questions & Suggestions

@@ -61,3 +67,5 @@ Please open an issue [here](https://github.com/eggjs/egg/issues).
## License

[MIT](LICENSE)

[egg-ant-design-pro]: https://github.com/eggjs/egg-ant-design-pro

This file was deleted.

Oops, something went wrong.
@@ -1,22 +1,36 @@
'use strict';

module.exports = appInfo => {
return {
assets: {
isLocal: appInfo.env === 'local',
url: '',
publicPath: '',
templatePath: '',
templateViewEngine: '',
contextKey: 'context',
devServer: {
waitStart: false,
command: '',
port: null,
env: {},
debug: false,
timeout: 60 * 1000,
},
module.exports = appInfo => ({
/**
* assets options
* @member Config#assets
* @property {String} url - the host of the assets, it will be `127.0.0.1:${devServer.port}` in development.
* @property {String} publicPath - the base path of the assets
* @property {String} templatePath - the file path of template rendering html
* @property {String} templateViewEngine - the view engine for rendering template
* @property {Boolean} contextKey - the property name of context, default is `context`
* @property {Boolean} devServer - configuration of local assets server
* @property {Boolean} devServer.command - a command for starting a server, such as `webpack`
* @property {Boolean} devServer.port - listening port for the server, it will be checked when starting
* @property {Boolean} devServer.timeout - the timeout for checking listening port
* @property {Boolean} devServer.env - custom environment
* @property {Boolean} devServer.debug - show stdout/stderr for devServer
* @property {Boolean} devServer.waitStart - whether wait devServer starting
*/
assets: {
isLocal: appInfo.env === 'local',
url: '',
publicPath: '',
templatePath: '',
templateViewEngine: '',
contextKey: 'context',
devServer: {
command: '',
port: null,
env: {},
debug: false,
timeout: 60 * 1000,
waitStart: false,
},
};
};
},
});
@@ -1,10 +1,13 @@
{
"name": "egg-view-assets",
"eggPlugin": {
"name": "assets"
"name": "assets",
"dependencies": [
"view"
]
},
"version": "1.0.0-alpha.2",
"description": "",
"description": "Manage frontend assets in development and production",
"keywords": [
"egg",
"eggPlugin",

0 comments on commit e369e2c

Please sign in to comment.