Skip to content

Commit

Permalink
0.4.0, 👊
Browse files Browse the repository at this point in the history
  • Loading branch information
sorrycc committed Dec 29, 2016
1 parent 780cf74 commit 468d525
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 5 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@ CSS 在开发模式下会走 style-loader (被内嵌在 JavaScript 文件中),

关于配置的一些基本概念:

* 配置存于 `.roadhogrc` 文件中
* 配置存于 `.roadhogrc` 文件中(如果你不喜欢 JSON 配置,可以用 `.roadhogrc.js` 以 JS 的方式编写,支持 ES6)
* 格式为 `JSON`,允许注释
* 布尔类型的配置项默认值均为 `false`
* 支持通过 `webpack.config.js` 以编码的方式进行配置,但不推荐,因为 roadhog 本身的 major 或 minor 升级可能会引起兼容问题。使用时会给予警告⚠️⚠️⚠️,详见 [#36](https://github.com/sorrycc/roadhog/issues/36) 。(`webpack.config.js` 本身的编写支持 ES6,会通过 babal-register 做一层转换。)

默认配置:

Expand All @@ -104,11 +105,14 @@ CSS 在开发模式下会走 style-loader (被内嵌在 JavaScript 文件中),
"disableCSSModules": false,
"publicPath": "/",
"outputPath": "./dist",
"theme": null,
"extraBabelPlugins": [],
"autoprefixer": null,
"proxy": null,
"externals": null,
"multipage": false,
"define": null,
"env": null,
"theme": null,
}
```

Expand Down Expand Up @@ -193,6 +197,18 @@ $ npm i babel-runtime --save

如果要做数据 mock,可以考虑和 [json-server](https://github.com/typicode/json-server) 结合使用,把 `/api` 代理到 json-server 启动的端口。

### externals

配置 webpack 的 [externals](http://webpack.github.io/docs/configuration.html#externals) 属性。

### multipage

配置是否多页应用。多页应用会自动提取公共部分为 common.js 和 common.css 。

### define

配置 webpack 的 [DefinePlugin](http://webpack.github.io/docs/list-of-plugins.html#defineplugin) 插件,define 的值会自动做 `JSON.stringify` 处理。

### env

针对特定的环境进行配置。server 的环境变量是 `development`,build 的环境变量是 `production`
Expand Down
20 changes: 18 additions & 2 deletions README_en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ $ roadhog test

Some basic concepts about configuration:

* Configuration is stored in the `.roadhogrc` file
* Configuration is stored in the `.roadhogrc` file (If you don't like JSON, try to use `.roadhogrc.js`, support ES6)
* `JSON` format, comments allowed
* Default value of boolean configuration item is always `false`
* Support configure with `webpack.config.js` (support ES6), but it's not recommended, since roadhog's major or minor upgrade will cause compatibility problem. View detail on [#36](https://github.com/sorrycc/roadhog/issues/36)

Default configuration:

Expand All @@ -63,11 +64,14 @@ Default configuration:
"disableCSSModules": false,
"publicPath": "/",
"outputPath": "./dist",
"theme": null,
"extraBabelPlugins": [],
"autoprefixer": null,
"proxy": null,
"externals": null,
"multipage": false,
"define": null,
"env": null,
"theme": null,
}
```

Expand Down Expand Up @@ -135,6 +139,18 @@ e.g.

Then, when accessing `/api/users`, you will get the content of http://jsonplaceholder.typicode.com/users .

### externals

Specify the [externals](http://webpack.github.io/docs/configuration.html#externals) configuration of webpack.

### multipage

Speficy if has multi pages. If true, roadhog will extract common chunks as `common.js` and `common.css`.

### define

Specify the [DefinePlugin](http://webpack.github.io/docs/list-of-plugins.html#defineplugin) configuration of webpack. The value will be transform by `JSON.stringify` automatically.

### env

Set specific options for certain environment. `development` is for server, and `production` is for build.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "roadhog",
"version": "0.3.2",
"version": "0.4.0",
"description": "Cli tool for serve and build react app, based on create-react-app, support JSON pattern config.",
"bin": {
"roadhog": "./bin/roadhog.js"
Expand Down

0 comments on commit 468d525

Please sign in to comment.