Skip to content

Commit 981d331

Browse files
author
unknown
committed
'merge'
1 parent c29ab6a commit 981d331

File tree

22 files changed

+466
-35
lines changed

22 files changed

+466
-35
lines changed

README.md

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
1-
# vue-webpack-boilerplate
1+
# vue-init
22

3-
> A full-featured Webpack setup with hot-reload, lint-on-save, unit testing & css extraction.
4-
5-
> This template is Vue 2.0 compatible. For Vue 1.x use this command: `vue init webpack#1.0 my-project`
6-
7-
## Documentation
8-
9-
- [For this template](http://vuejs-templates.github.io/webpack): common questions specific to this template are answered and each part is described in greater detail
10-
- [For Vue 2.0](http://vuejs.org/guide/): general information about how to work with Vue, not specific to this template
3+
> This respository is a fork from [vuejs-templates/webpack](https://github.com/vuejs-templates/webpack). You may want an official template there.
4+
> This template is Vue 2.0 compatible only.
115
126
## Usage
137

148
This is a project template for [vue-cli](https://github.com/vuejs/vue-cli). **It is recommended to use npm 3+ for a more efficient dependency tree.**
159

1610
``` bash
1711
$ npm install -g vue-cli
18-
$ vue init webpack my-project
12+
$ vue init shangxinbo/vue-init my-project
1913
$ cd my-project
2014
$ npm install
2115
$ npm run dev
2216
```
17+
If port 8080 is already in use on your machine you must change the port number in `/config/index.js`. Otherwise `npm run dev` will fail.
2318

2419
This will scaffold the project using the `master` branch. If you wish to use the latest version of the webpack template, do the following instead:
2520

@@ -31,6 +26,19 @@ $ vue init webpack#develop my-project
3126

3227
The development server will run on port 8080 by default. If that port is already in use on your machine, the next free port will be used.
3328

29+
## Docs And Features
30+
31+
you may want to read docs [here](http://vuejs-templates.github.io/webpack/) because this template is exactly the same with vuejs-temlates/webpack. __except that:__
32+
33+
* Add a mock server by express for data-mock (look in dirs named api and proxy). When `npm run dev`, it will start in a child process.
34+
* Use [mockjs](https://github.com/nuysoft/Mock/tree/refactoring) to mock random data
35+
* Add `less-loader` and `less`
36+
* Add [vuex](https://github.com/vuejs/vuex) for vue
37+
* Add [vue-resource](https://github.com/pagekit/vue-resource) for ajax
38+
* Change editerconfig `indent_size = 4`
39+
* Change eslint pick preset `none (eslint:recommended and config yourself)`. Detail in '.eslintrc.js'
40+
* Add src/router/index.js to eslintignore, beacause webpack2.0 use 'System.import' which is error for eslint
41+
3442
## What's Included
3543

3644
- `npm run dev`: first-in-class development experience.
@@ -40,6 +48,10 @@ The development server will run on port 8080 by default. If that port is already
4048
- Lint-on-save with ESLint
4149
- Source maps
4250

51+
- `npm run proxy`: proxy request and response to integrate real restfull.
52+
- change mock server to proxy real restful.
53+
- proxy URL and PORT config in `config/dev.env.js`
54+
4355
- `npm run build`: Production ready build.
4456
- JavaScript minified with [UglifyJS v3](https://github.com/mishoo/UglifyJS2/tree/harmony).
4557
- HTML minified with [html-minifier](https://github.com/kangax/html-minifier).
@@ -64,3 +76,15 @@ You can fork this repo to create your own boilerplate, and use it with `vue-cli`
6476
``` bash
6577
vue init username/repo my-project
6678
```
79+
80+
### remarks
81+
``` bash
82+
$ git remote
83+
origin
84+
$ git remote add https://github.com/vuejs-templates/webpack.git
85+
$ git remote
86+
office
87+
origin
88+
$ git fetch office
89+
$ git pull office master
90+
$ 解决冲突并提交

meta.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ module.exports = {
9595
short: 'Airbnb',
9696
},
9797
{
98-
name: 'none (configure it yourself)',
98+
name: 'none (eslint:recommended and config yourself)',
9999
value: 'none',
100100
short: 'none',
101101
},

template/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
}],
99
"stage-2"
1010
],
11+
"ignore": [
12+
"./src/assets/**/*.js"
13+
],
1114
"plugins": ["transform-vue-jsx", "transform-runtime"]{{#if_or unit e2e}},
1215
"env": {
1316
"test": {

template/.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ root = true
33
[*]
44
charset = utf-8
55
indent_style = space
6-
indent_size = 2
6+
indent_size = 4
77
end_of_line = lf
88
insert_final_newline = true
99
trim_trailing_whitespace = true

template/.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
src/router/index.js
2+
src/assets/**/*.js
13
/build/
24
/config/
35
/dist/

template/.eslintrc.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ module.exports = {
2525
{{#if_eq lintConfig "none"}}
2626
// https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
2727
// consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
28-
extends: ['plugin:vue/essential'],
28+
extends: ['plugin:vue/essential','eslint:recommended'],
2929
{{/if_eq}}
3030
// required to lint *.vue files
3131
plugins: [
@@ -68,6 +68,15 @@ module.exports = {
6868
optionalDependencies: ['test/unit/index.js']
6969
}],
7070
{{/if_eq}}
71+
{{#if_eq lintConfig "none"}}
72+
'no-implied-eval': 1,
73+
'no-loop-func': 1,
74+
'indent': ["warn", 4, { "SwitchCase": 1 }],
75+
'no-mixed-spaces-and-tabs': 1,
76+
'semi': ["error", "never"],
77+
'no-console':0,
78+
'no-unused-vars':0,
79+
{{/if_eq}}
7180
// allow debugger during development
7281
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
7382
}

template/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ npm install
1111
# serve with hot reload at localhost:8080
1212
npm run dev
1313

14+
# serve with proxy to use data from restful
15+
npm run proxy
16+
1417
# build for production with minification
1518
npm run build
1619

template/api/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
2+
var Mock = require('mockjs')
3+
var Random = Mock.Random
4+
module.exports = function (req, res) {
5+
return {
6+
"user": {
7+
"id": 1,
8+
"username": "admin",
9+
"nickname": "",
10+
"phone": "13488888888"
11+
}
12+
}
13+
}

template/build/webpack.base.conf.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function resolve (dir) {
2222
module.exports = {
2323
context: path.resolve(__dirname, '../'),
2424
entry: {
25+
polyfill:'babel-polyfill',
2526
app: './src/main.js'
2627
},
2728
output: {
@@ -38,6 +39,9 @@ module.exports = {
3839
'vue$': 'vue/dist/vue.esm.js',
3940
{{/if_eq}}
4041
'@': resolve('src'),
42+
'src': resolve('src'),
43+
'assets': resolve('src/assets'),
44+
'components': resolve('src/components')
4145
}
4246
},
4347
module: {

template/config/dev.env.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ const merge = require('webpack-merge')
33
const prodEnv = require('./prod.env')
44

55
module.exports = merge(prodEnv, {
6+
MOCK_SERVER_PORT: '3009',
7+
PROXY_HOST: 'https://shangxinbo.github.io/',
8+
PROXY_PORT: '80',
69
NODE_ENV: '"development"'
710
})

0 commit comments

Comments
 (0)