optimize project structure
This commit is contained in:
parent
5b7fe51535
commit
4df4ea1911
9 changed files with 17 additions and 47 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -15,4 +15,4 @@ npm-debug.log
|
||||||
*.swp
|
*.swp
|
||||||
*.swo
|
*.swo
|
||||||
*.log
|
*.log
|
||||||
test/dist
|
test/dist/
|
||||||
|
|
|
@ -15,7 +15,7 @@ module.exports = {
|
||||||
},
|
},
|
||||||
// 输出
|
// 输出
|
||||||
output: {
|
output: {
|
||||||
path: path.join(__dirname, '.././test/dist'),
|
path: path.join(__dirname, '../test/dist'),
|
||||||
publicPath: '/test/dist/',
|
publicPath: '/test/dist/',
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
chunkFilename: '[name].chunk.js'
|
chunkFilename: '[name].chunk.js'
|
||||||
|
@ -38,7 +38,7 @@ module.exports = {
|
||||||
"style-loader",
|
"style-loader",
|
||||||
"css-loader?sourceMap",
|
"css-loader?sourceMap",
|
||||||
{
|
{
|
||||||
publicPath: "../test/dist/"
|
publicPath: "/test/dist/"
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
less: ExtractTextPlugin.extract(
|
less: ExtractTextPlugin.extract(
|
||||||
|
@ -64,8 +64,8 @@ module.exports = {
|
||||||
new ExtractTextPlugin("[name].css",{ allChunks : true,resolve : ['modules'] }), // 提取CSS
|
new ExtractTextPlugin("[name].css",{ allChunks : true,resolve : ['modules'] }), // 提取CSS
|
||||||
new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'), // 提取第三方库
|
new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'), // 提取第三方库
|
||||||
new HtmlWebpackPlugin({ // 构建html文件
|
new HtmlWebpackPlugin({ // 构建html文件
|
||||||
filename: '../../test/index.html',
|
filename: 'index.html',
|
||||||
template: './test/template/index.html',
|
template: './test/index.html',
|
||||||
inject: 'body'
|
inject: 'body'
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"init": "webpack --progress --config build/webpack.config.js",
|
"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"
|
"build": "gulp --gulpfile build/build-style.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
@import "../../src/styles/index.less";
|
@import "../src/styles/index.less";
|
||||||
@import "../../src/styles/package.less";
|
@import "../src/styles/package.less";
|
||||||
</style>
|
</style>
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
|
@ -2,9 +2,9 @@
|
||||||
<html lang="zh-CN">
|
<html lang="zh-CN">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Webpack App</title>
|
<title>iView test page</title>
|
||||||
<link href="/test/dist/main.css" rel="stylesheet"></head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<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>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import VueRouter from 'vue-router';
|
import VueRouter from 'vue-router';
|
||||||
import App from './components/app.vue';
|
import App from './app.vue';
|
||||||
|
|
||||||
Vue.use(VueRouter);
|
Vue.use(VueRouter);
|
||||||
|
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="zh-CN">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Webpack App</title>
|
|
||||||
<link href="/test/dist/main.css" rel="stylesheet"></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>
|
|
|
@ -1,10 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="zh-CN">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Webpack App</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="app"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,10 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="zh-CN">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Webpack App</title>
|
|
||||||
<link href="/test/dist/main.css" rel="stylesheet"></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>
|
|
Loading…
Add table
Reference in a new issue