From 4df4ea1911512d3688d231946835aef4f01a0a28 Mon Sep 17 00:00:00 2001 From: jingsam Date: Fri, 28 Oct 2016 10:27:44 +0800 Subject: [PATCH] optimize project structure --- .gitignore | 2 +- build/webpack.config.js | 10 +++++----- package.json | 2 +- test/app.vue | 27 +++++++++++++++++++++++++++ test/components/app.vue | 27 --------------------------- test/index.html | 8 ++++---- test/main.js | 4 ++-- test/src/index.html | 10 ---------- test/template/index.html | 10 ---------- test/test/index.html | 10 ---------- 10 files changed, 40 insertions(+), 70 deletions(-) create mode 100644 test/app.vue delete mode 100644 test/components/app.vue delete mode 100644 test/src/index.html delete mode 100644 test/template/index.html delete mode 100644 test/test/index.html diff --git a/.gitignore b/.gitignore index 6c2b3bf..a416849 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,4 @@ npm-debug.log *.swp *.swo *.log -test/dist \ No newline at end of file +test/dist/ diff --git a/build/webpack.config.js b/build/webpack.config.js index 8a21421..2c2f424 100644 --- a/build/webpack.config.js +++ b/build/webpack.config.js @@ -15,7 +15,7 @@ module.exports = { }, // 输出 output: { - path: path.join(__dirname, '.././test/dist'), + path: path.join(__dirname, '../test/dist'), publicPath: '/test/dist/', filename: '[name].js', chunkFilename: '[name].chunk.js' @@ -38,7 +38,7 @@ module.exports = { "style-loader", "css-loader?sourceMap", { - publicPath: "../test/dist/" + publicPath: "/test/dist/" } ), less: ExtractTextPlugin.extract( @@ -64,9 +64,9 @@ module.exports = { new ExtractTextPlugin("[name].css",{ allChunks : true,resolve : ['modules'] }), // 提取CSS new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'), // 提取第三方库 new HtmlWebpackPlugin({ // 构建html文件 - filename: '../../test/index.html', - template: './test/template/index.html', + filename: 'index.html', + template: './test/index.html', inject: 'body' }) ] -}; \ No newline at end of file +}; diff --git a/package.json b/package.json index 25e57e9..9db72ca 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "main": "src/index.js", "scripts": { "init": "webpack --progress --config build/webpack.config.js", - "dev": "webpack-dev-server --content-base test --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.config.js", + "dev": "webpack-dev-server --content-base test/dist/ --open --inline --hot --compress --history-api-fallback --port 8081 --config build/webpack.config.js", "build": "gulp --gulpfile build/build-style.js" }, "repository": { diff --git a/test/app.vue b/test/app.vue new file mode 100644 index 0000000..7c7fa7b --- /dev/null +++ b/test/app.vue @@ -0,0 +1,27 @@ + + + diff --git a/test/components/app.vue b/test/components/app.vue deleted file mode 100644 index b697d96..0000000 --- a/test/components/app.vue +++ /dev/null @@ -1,27 +0,0 @@ - - - diff --git a/test/index.html b/test/index.html index d726d4f..90bec8e 100644 --- a/test/index.html +++ b/test/index.html @@ -2,9 +2,9 @@ - Webpack App - + iView test page +
- - \ No newline at end of file + + diff --git a/test/main.js b/test/main.js index 5a0453b..01731bf 100644 --- a/test/main.js +++ b/test/main.js @@ -3,7 +3,7 @@ */ import Vue from 'vue'; import VueRouter from 'vue-router'; -import App from './components/app.vue'; +import App from './app.vue'; Vue.use(VueRouter); @@ -79,4 +79,4 @@ router.afterEach(function (transition) { router.redirect({ '*': "/index" }); -router.start(App, '#app'); \ No newline at end of file +router.start(App, '#app'); diff --git a/test/src/index.html b/test/src/index.html deleted file mode 100644 index d726d4f..0000000 --- a/test/src/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - Webpack App - - -
- - \ No newline at end of file diff --git a/test/template/index.html b/test/template/index.html deleted file mode 100644 index 2c87227..0000000 --- a/test/template/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - Webpack App - - -
- - \ No newline at end of file diff --git a/test/test/index.html b/test/test/index.html deleted file mode 100644 index d726d4f..0000000 --- a/test/test/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - Webpack App - - -
- - \ No newline at end of file -- libgit2 0.21.4