Commit 64bd05f7ff9760f248ed25aebe1b4451e7cfdbf2
Committed by
GitHub
Merge pull request #37 from jingsam/master
optimize project structure
Showing
9 changed files
with
17 additions
and
47 deletions
Show diff stats
.gitignore
build/webpack.config.js
@@ -15,7 +15,7 @@ module.exports = { | @@ -15,7 +15,7 @@ module.exports = { | ||
15 | }, | 15 | }, |
16 | // 输出 | 16 | // 输出 |
17 | output: { | 17 | output: { |
18 | - path: path.join(__dirname, '.././test/dist'), | 18 | + path: path.join(__dirname, '../test/dist'), |
19 | publicPath: '/test/dist/', | 19 | publicPath: '/test/dist/', |
20 | filename: '[name].js', | 20 | filename: '[name].js', |
21 | chunkFilename: '[name].chunk.js' | 21 | chunkFilename: '[name].chunk.js' |
@@ -38,7 +38,7 @@ module.exports = { | @@ -38,7 +38,7 @@ module.exports = { | ||
38 | "style-loader", | 38 | "style-loader", |
39 | "css-loader?sourceMap", | 39 | "css-loader?sourceMap", |
40 | { | 40 | { |
41 | - publicPath: "../test/dist/" | 41 | + publicPath: "/test/dist/" |
42 | } | 42 | } |
43 | ), | 43 | ), |
44 | less: ExtractTextPlugin.extract( | 44 | less: ExtractTextPlugin.extract( |
@@ -64,9 +64,9 @@ module.exports = { | @@ -64,9 +64,9 @@ module.exports = { | ||
64 | new ExtractTextPlugin("[name].css",{ allChunks : true,resolve : ['modules'] }), // 提取CSS | 64 | new ExtractTextPlugin("[name].css",{ allChunks : true,resolve : ['modules'] }), // 提取CSS |
65 | new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'), // 提取第三方库 | 65 | new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'), // 提取第三方库 |
66 | new HtmlWebpackPlugin({ // 构建html文件 | 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 | inject: 'body' | 69 | inject: 'body' |
70 | }) | 70 | }) |
71 | ] | 71 | ] |
72 | -}; | ||
73 | \ No newline at end of file | 72 | \ No newline at end of file |
73 | +}; |
package.json
@@ -16,7 +16,7 @@ | @@ -16,7 +16,7 @@ | ||
16 | "main": "src/index.js", | 16 | "main": "src/index.js", |
17 | "scripts": { | 17 | "scripts": { |
18 | "init": "webpack --progress --config build/webpack.config.js", | 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 | "build": "gulp --gulpfile build/build-style.js" | 20 | "build": "gulp --gulpfile build/build-style.js" |
21 | }, | 21 | }, |
22 | "repository": { | 22 | "repository": { |
test/components/app.vue renamed to test/app.vue
1 | <style lang="less"> | 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 | </style> | 4 | </style> |
5 | <template> | 5 | <template> |
6 | <div> | 6 | <div> |
@@ -15,13 +15,13 @@ | @@ -15,13 +15,13 @@ | ||
15 | } | 15 | } |
16 | }, | 16 | }, |
17 | ready: function() { | 17 | ready: function() { |
18 | - | 18 | + |
19 | }, | 19 | }, |
20 | beforeDestroy: function() { | 20 | beforeDestroy: function() { |
21 | 21 | ||
22 | }, | 22 | }, |
23 | methods: { | 23 | methods: { |
24 | - | 24 | + |
25 | } | 25 | } |
26 | } | 26 | } |
27 | </script> | 27 | </script> |
test/index.html
@@ -2,9 +2,9 @@ | @@ -2,9 +2,9 @@ | ||
2 | <html lang="zh-CN"> | 2 | <html lang="zh-CN"> |
3 | <head> | 3 | <head> |
4 | <meta charset="UTF-8"> | 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 | <body> | 7 | <body> |
8 | <div id="app"></div> | 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 | \ No newline at end of file | 9 | \ No newline at end of file |
10 | +</body> | ||
11 | +</html> |
test/main.js
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | */ | 3 | */ |
4 | import Vue from 'vue'; | 4 | import Vue from 'vue'; |
5 | import VueRouter from 'vue-router'; | 5 | import VueRouter from 'vue-router'; |
6 | -import App from './components/app.vue'; | 6 | +import App from './app.vue'; |
7 | 7 | ||
8 | Vue.use(VueRouter); | 8 | Vue.use(VueRouter); |
9 | 9 | ||
@@ -79,4 +79,4 @@ router.afterEach(function (transition) { | @@ -79,4 +79,4 @@ router.afterEach(function (transition) { | ||
79 | router.redirect({ | 79 | router.redirect({ |
80 | '*': "/index" | 80 | '*': "/index" |
81 | }); | 81 | }); |
82 | -router.start(App, '#app'); | ||
83 | \ No newline at end of file | 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 | \ No newline at end of file | 0 | \ No newline at end of file |
test/template/index.html deleted
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 | \ No newline at end of file | 0 | \ No newline at end of file |