Commit 64bd05f7ff9760f248ed25aebe1b4451e7cfdbf2

Authored by Aresn
Committed by GitHub
2 parents 5b7fe515 4df4ea19

Merge pull request #37 from jingsam/master

optimize project structure
.gitignore
... ... @@ -15,4 +15,4 @@ npm-debug.log
15 15 *.swp
16 16 *.swo
17 17 *.log
18   -test/dist
19 18 \ No newline at end of file
  19 +test/dist/
... ...
build/webpack.config.js
... ... @@ -15,7 +15,7 @@ module.exports = {
15 15 },
16 16 // 输出
17 17 output: {
18   - path: path.join(__dirname, '.././test/dist'),
  18 + path: path.join(__dirname, '../test/dist'),
19 19 publicPath: '/test/dist/',
20 20 filename: '[name].js',
21 21 chunkFilename: '[name].chunk.js'
... ... @@ -38,7 +38,7 @@ module.exports = {
38 38 "style-loader",
39 39 "css-loader?sourceMap",
40 40 {
41   - publicPath: "../test/dist/"
  41 + publicPath: "/test/dist/"
42 42 }
43 43 ),
44 44 less: ExtractTextPlugin.extract(
... ... @@ -64,9 +64,9 @@ module.exports = {
64 64 new ExtractTextPlugin("[name].css",{ allChunks : true,resolve : ['modules'] }), // 提取CSS
65 65 new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'), // 提取第三方库
66 66 new HtmlWebpackPlugin({ // 构建html文件
67   - filename: '../../test/index.html',
68   - template: './test/template/index.html',
  67 + filename: 'index.html',
  68 + template: './test/index.html',
69 69 inject: 'body'
70 70 })
71 71 ]
72   -};
73 72 \ No newline at end of file
  73 +};
... ...
package.json
... ... @@ -16,7 +16,7 @@
16 16 "main": "src/index.js",
17 17 "scripts": {
18 18 "init": "webpack --progress --config build/webpack.config.js",
19   - "dev": "webpack-dev-server --content-base test --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.config.js",
  19 + "dev": "webpack-dev-server --content-base test/dist/ --open --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.config.js",
20 20 "build": "gulp --gulpfile build/build-style.js"
21 21 },
22 22 "repository": {
... ...
test/components/app.vue renamed to test/app.vue
1 1 <style lang="less">
2   - @import "../../src/styles/index.less";
3   - @import "../../src/styles/package.less";
  2 + @import "../src/styles/index.less";
  3 + @import "../src/styles/package.less";
4 4 </style>
5 5 <template>
6 6 <div>
... ... @@ -15,13 +15,13 @@
15 15 }
16 16 },
17 17 ready: function() {
18   -
  18 +
19 19 },
20 20 beforeDestroy: function() {
21 21  
22 22 },
23 23 methods: {
24   -
  24 +
25 25 }
26 26 }
27 27 </script>
... ...
test/index.html
... ... @@ -2,9 +2,9 @@
2 2 <html lang="zh-CN">
3 3 <head>
4 4 <meta charset="UTF-8">
5   - <title>Webpack App</title>
6   -<link href="/test/dist/main.css" rel="stylesheet"></head>
  5 + <title>iView test page</title>
  6 +</head>
7 7 <body>
8 8 <div id="app"></div>
9   -<script type="text/javascript" src="/test/dist/vendors.js"></script><script type="text/javascript" src="/test/dist/main.js"></script></body>
10   -</html>
11 9 \ No newline at end of file
  10 +</body>
  11 +</html>
... ...
test/main.js
... ... @@ -3,7 +3,7 @@
3 3 */
4 4 import Vue from 'vue';
5 5 import VueRouter from 'vue-router';
6   -import App from './components/app.vue';
  6 +import App from './app.vue';
7 7  
8 8 Vue.use(VueRouter);
9 9  
... ... @@ -79,4 +79,4 @@ router.afterEach(function (transition) {
79 79 router.redirect({
80 80 '*': "/index"
81 81 });
82   -router.start(App, '#app');
83 82 \ No newline at end of file
  83 +router.start(App, '#app');
... ...
test/src/index.html deleted
1   -<!DOCTYPE html>
2   -<html lang="zh-CN">
3   -<head>
4   - <meta charset="UTF-8">
5   - <title>Webpack App</title>
6   -<link href="/test/dist/main.css" rel="stylesheet"></head>
7   -<body>
8   - <div id="app"></div>
9   -<script type="text/javascript" src="/test/dist/vendors.js"></script><script type="text/javascript" src="/test/dist/main.js"></script></body>
10   -</html>
11 0 \ No newline at end of file
test/template/index.html deleted
1   -<!DOCTYPE html>
2   -<html lang="zh-CN">
3   -<head>
4   - <meta charset="UTF-8">
5   - <title>Webpack App</title>
6   -</head>
7   -<body>
8   - <div id="app"></div>
9   -</body>
10   -</html>
11 0 \ No newline at end of file
test/test/index.html deleted
1   -<!DOCTYPE html>
2   -<html lang="zh-CN">
3   -<head>
4   - <meta charset="UTF-8">
5   - <title>Webpack App</title>
6   -<link href="/test/dist/main.css" rel="stylesheet"></head>
7   -<body>
8   - <div id="app"></div>
9   -<script type="text/javascript" src="/test/dist/vendors.js"></script><script type="text/javascript" src="/test/dist/main.js"></script></body>
10   -</html>
11 0 \ No newline at end of file