Skip to content

Commit

Permalink
optimize project structure
Browse files Browse the repository at this point in the history
  • Loading branch information
jingsam committed Oct 28, 2016
1 parent 5b7fe51 commit 4df4ea1
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ npm-debug.log
*.swp
*.swo
*.log
test/dist
test/dist/
10 changes: 5 additions & 5 deletions build/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -38,7 +38,7 @@ module.exports = {
"style-loader",
"css-loader?sourceMap",
{
publicPath: "../test/dist/"
publicPath: "/test/dist/"
}
),
less: ExtractTextPlugin.extract(
Expand All @@ -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'
})
]
};
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions test/components/app.vue → test/app.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<style lang="less">
@import "../../src/styles/index.less";
@import "../../src/styles/package.less";
@import "../src/styles/index.less";
@import "../src/styles/package.less";
</style>
<template>
<div>
Expand All @@ -15,13 +15,13 @@
}
},
ready: function() {
},
beforeDestroy: function() {
},
methods: {
}
}
</script>
8 changes: 4 additions & 4 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>Webpack App</title>
<link href="/test/dist/main.css" rel="stylesheet"></head>
<title>iView test page</title>
</head>
<body>
<div id="app"></div>
<script type="text/javascript" src="/test/dist/vendors.js"></script><script type="text/javascript" src="/test/dist/main.js"></script></body>
</html>
</body>
</html>
4 changes: 2 additions & 2 deletions test/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -79,4 +79,4 @@ router.afterEach(function (transition) {
router.redirect({
'*': "/index"
});
router.start(App, '#app');
router.start(App, '#app');
10 changes: 0 additions & 10 deletions test/src/index.html

This file was deleted.

10 changes: 0 additions & 10 deletions test/template/index.html

This file was deleted.

10 changes: 0 additions & 10 deletions test/test/index.html

This file was deleted.

0 comments on commit 4df4ea1

Please sign in to comment.