Skip to content

Commit be0d331

Browse files
author
wanglinquan
committed
docs: refactor mostly docs
1 parent a0aedca commit be0d331

File tree

1 file changed

+44
-5
lines changed

1 file changed

+44
-5
lines changed

README.md

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# vue-cli-plugin-multiple-page
22

3-
> build/watch multiple page one time for vue-cli
3+
> A plugin that bundle multiple page based-on vue-cli. Unlike `vue-cli's pages` configuration, it's handled by sharding multiple pages into different webpack configurations
4+
5+
## Usage
6+
7+
Install the plugin in your project created by vue-cli, if not please refer to [Not Vue-CLI created Project](#not-vue-cli-created-project)
8+
9+
``` sh
10+
vue add multiple-page
11+
```
412

513
## Commands
614

@@ -51,18 +59,18 @@ vue-cli-service build-multi --key page,page1 # build page,page1 two entries
5159
}
5260
```
5361

54-
The final result of above configuration will be generates:
62+
The configuration file above will generates the following corresponding paths:
5563

5664
- entry: [`yourProject/resources/assets/js/views/page/index.js`, `yourProject/resources/assets/js/views/page1/index.js`]
5765
- output: [`yourProject/public/js/v/page-index/index.js`, `yourProject/public/js/v/page1-index/index.js`]
5866

5967
### watch-multi
6068

61-
The command like `build-multi`, but it in watch mode
69+
This command, like the `vue-cli-service watch` command, It listens for changes to the entry file of configuration by passing the specified `--key` to bundle (in `watch` mode)
6270

63-
## Custom Config
71+
## Customize Configuration
6472

65-
This plugin provide custom config file that you can specify entries manually in Programmatically. You can create a file named `multiple-page.config.js`, that content like below:
73+
The plugin provides the ability to customize the configuration so that you can programmatically expose the configuration of multiple pages by creating a file called `multiple-page.config.js`:
6674

6775
``` js
6876
const path = require('path')
@@ -89,6 +97,37 @@ module.exports = {
8997

9098
If you have both files (`Views.json``multiple-page.config.js`) in your root directory, The `multiple-page.config.js` file have a higher priority.
9199

100+
## Not Vue-CLI created Project
101+
102+
If your project is not created by vue-cli. please refer to the following steps. (This scenario is suitable for older, multiple-page projects that are rendered primarily by backend template engines)
103+
104+
`step1`: Installing these dependencies in your project if you haven't installed them
105+
106+
``` sh
107+
yarn add @vue/cli-service vue-template-compiler --dev
108+
yarn add vue
109+
```
110+
111+
`step2`: Add the following script commands to your `package.json` file:
112+
113+
``` json
114+
{
115+
"scripts": {
116+
"init:config": "vue-cli-service init-config",
117+
"watch": "vue-cli-service watch-multi",
118+
"build": "vue-cli-service build-multi"
119+
}
120+
}
121+
```
122+
123+
`step3`: Add this plugin to your project
124+
125+
``` sh
126+
vue add multiple-page
127+
```
128+
129+
Finally Enjoy the same features as vue-cli
130+
92131
## TODO
93132

94133
- [] test cases

0 commit comments

Comments
 (0)