Merge pull request #111 from QingWei-Li/fix/update-demo-config

Update demo config
pull/115/head
杨奕 2016-09-21 04:07:19 -05:00 committed by GitHub
commit db562a613d
3 changed files with 17 additions and 11 deletions

View File

@ -6,7 +6,9 @@
<title>Element</title> <title>Element</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div><% if (process.env.NODE_ENV === 'production') { %>
<script src="//unpkg.com/vue@2.0.0-rc.6/dist/vue.min.js"></script>
<script src="//unpkg.com/vue-router@2.0.0-rc.5/dist/vue-router.js"></script><% } %>
</body> </body>
<% if (process.env.NODE_ENV === 'production') { %><script> <% if (process.env.NODE_ENV === 'production') { %><script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){

View File

@ -8,11 +8,12 @@
"src" "src"
], ],
"scripts": { "scripts": {
"dev": "npm run bootstrap && (node bin/iconInit.js & node bin/build-entry.js) && cooking watch -c scripts/cooking.demo.js -p", "build:file": "node bin/iconInit.js & node bin/build-entry.js",
"dist": "npm run lint && del -f lib && cooking build -c scripts/cooking.conf.js,scripts/cooking.common.js -p && cooking build -c scripts/cooking.component.js -p && npm run build:theme", "dev": "npm run bootstrap && npm run build:file && cooking watch -c scripts/cooking.demo.js -p",
"dist": "npm run lint && del -f lib && cooking build -c scripts/cooking.conf.js,scripts/cooking.common.js,scripts/cooking.component.js -p && npm run build:theme",
"dist:all": "node bin/build-all.js && npm run build:theme", "dist:all": "node bin/build-all.js && npm run build:theme",
"build:theme": "gulp build --gulpfile packages/theme-default/gulpfile.js && cp-cli packages/theme-default/lib lib/theme-default", "build:theme": "gulp build --gulpfile packages/theme-default/gulpfile.js && cp-cli packages/theme-default/lib lib/theme-default",
"deploy": "cooking build -c scripts/cooking.demo.js -p && echo element.eleme.io>>examples/element-ui/CNAME && gh-pages -d examples/element-ui --remote origin && del examples/element-ui", "deploy": "npm run build:file && cooking build -c scripts/cooking.demo.js -p && echo element.eleme.io>>examples/element-ui/CNAME && gh-pages -d examples/element-ui --remote origin && del examples/element-ui",
"bootstrap": "npm i && lerna bootstrap --loglevel=error", "bootstrap": "npm i && lerna bootstrap --loglevel=error",
"pub": "npm run dist && kp", "pub": "npm run dist && kp",
"pub:all": "npm run dist:all && lerna publish", "pub:all": "npm run dist:all && lerna publish",
@ -39,7 +40,7 @@
"babel-plugin-transform-vue-jsx": "^3.1.0", "babel-plugin-transform-vue-jsx": "^3.1.0",
"babel-preset-es2015": "^6.14.0", "babel-preset-es2015": "^6.14.0",
"cheerio": "^0.18.0", "cheerio": "^0.18.0",
"cooking": "^1.0.0", "cooking": "^1.1.0",
"cooking-lint": "^0.1.3", "cooking-lint": "^0.1.3",
"cooking-vue2": "^0.1.4", "cooking-vue2": "^0.1.4",
"cp-cli": "^1.0.2", "cp-cli": "^1.0.2",
@ -69,7 +70,7 @@
"url-loader": "^0.5.7", "url-loader": "^0.5.7",
"vue": "^2.0.0-rc.6", "vue": "^2.0.0-rc.6",
"vue-loader": "^9.4.2", "vue-loader": "^9.4.2",
"vue-markdown-loader": "^0.4.0", "vue-markdown-loader": "^0.5.1",
"vue-popup": "^0.2.4", "vue-popup": "^0.2.4",
"vue-router": "^2.0.0-beta.2", "vue-router": "^2.0.0-beta.2",
"webpack": "^1.13.2", "webpack": "^1.13.2",

View File

@ -12,10 +12,7 @@ function convert(str) {
} }
cooking.set({ cooking.set({
entry: { entry: './examples/entry.js',
app: './examples/entry.js',
vendor: ['vue', 'vue-router']
},
dist: './examples/element-ui/', dist: './examples/element-ui/',
template: './examples/index.tpl', template: './examples/index.tpl',
publicPath: '/element-ui/', publicPath: '/element-ui/',
@ -26,8 +23,9 @@ cooking.set({
publicPath: '/' publicPath: '/'
}, },
minimize: true, minimize: true,
chunk: 'vendor', chunk: true,
extractCSS: true, extractCSS: true,
sourceMap: true,
extends: ['vue2', 'lint'], extends: ['vue2', 'lint'],
postcss: function(webapck) { postcss: function(webapck) {
return [ return [
@ -115,4 +113,9 @@ Object.keys(Components).forEach(function(key) {
// 开发模式不需要将不存在的 style.css 打包进去 // 开发模式不需要将不存在的 style.css 打包进去
cooking.add('externals', externals); cooking.add('externals', externals);
if (process.env.NODE_ENV === 'production') {
cooking.add('externals.vue', 'Vue');
cooking.add('externals.vue-router', 'VueRouter');
}
module.exports = cooking.resolve(); module.exports = cooking.resolve();