Vue
npm install
npm run dev-local
dev-server localhost:9000
npm run dev
CSS hash
npm run build
build/config.js
JS src
HTML src/templates
src
index.js # Webpack JS
App.vue # Vue
assets # /
logo.png
components # .vue JS
Hello.vue
styl #
mixins.styl
variables.styl
templates # JS HTML
index.html
JS dist
HTML pages
run prod
CSS dist/css
15K JS
JS index / vendor / manifest manifest index vendor Webpack manifest vendor
JS HTML resources
HTML View applications/view
http://demo.com/foo/bar/resources/bundle.js
var bundlePath = path.join(process.cwd(), './resources')
var htmlPath = path.join(process.cwd(), './applications/view')
// ...
output: {
publicPath: '/foo/bar/resources/'
}
index foo entry
var entry = {
index: './src/index.js',
foo: './src/foo.js',
vendor: ['vue']
}
src/foo.js
src/templates/foo.html
webpack
Vue vendor.bundle.js
entry
vendor
var entry = {
index: './src/index.js',
foo: './src/foo.js',
vendor: ['vue', 'chart.js', 'vue-router'] // ...
}
src
node_modules
CSS
/* src/styl/foo.css */
@import '~styl/foo.css';
/* npm install CSS */
@import '~normalize.css';
devServer API module.exports.devServer
proxy
{
// ...
proxy: {
'/api': { target: 'http://backend-address/' }
}
}
Vue JS templates/index.html
pages/index.html
Webpack Webpack Configuration
0.2.1
0.2.0
0.1.2
stylus CSS0.1.1
vue runtime0.1.0
Webpack 2