diff --git a/examples/chat/main.js b/examples/chat/app.js similarity index 100% rename from examples/chat/main.js rename to examples/chat/app.js diff --git a/examples/chat/index.html b/examples/chat/index.html index 095d94962..ad51bd490 100644 --- a/examples/chat/index.html +++ b/examples/chat/index.html @@ -7,6 +7,7 @@
- + + diff --git a/examples/counter-hot/main.js b/examples/counter-hot/app.js similarity index 100% rename from examples/counter-hot/main.js rename to examples/counter-hot/app.js diff --git a/examples/counter-hot/index.html b/examples/counter-hot/index.html index 3020a2555..579002635 100644 --- a/examples/counter-hot/index.html +++ b/examples/counter-hot/index.html @@ -3,9 +3,11 @@ vuex counter example +
- + + diff --git a/examples/counter/main.js b/examples/counter/app.js similarity index 100% rename from examples/counter/main.js rename to examples/counter/app.js diff --git a/examples/counter/index.html b/examples/counter/index.html index 3020a2555..e2873a87b 100644 --- a/examples/counter/index.html +++ b/examples/counter/index.html @@ -3,9 +3,11 @@ vuex counter example +
- + + diff --git a/examples/global.css b/examples/global.css new file mode 100644 index 000000000..e093e239b --- /dev/null +++ b/examples/global.css @@ -0,0 +1,18 @@ +html, body { + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"; + color: #2c3e50; +} + +ul { + line-height: 1.5em; + padding-left: 1.5em; +} + +a { + color: #7f8c8d; + text-decoration: none; +} + +a:hover { + color: #4fc08d; +} diff --git a/examples/index.html b/examples/index.html new file mode 100644 index 000000000..1b3db3f2b --- /dev/null +++ b/examples/index.html @@ -0,0 +1,18 @@ + + + + + Vuex Examples + + + +

Vuex Examples

+ + + diff --git a/examples/shopping-cart/main.js b/examples/shopping-cart/app.js similarity index 100% rename from examples/shopping-cart/main.js rename to examples/shopping-cart/app.js diff --git a/examples/shopping-cart/index.html b/examples/shopping-cart/index.html index b159196f1..f7457fe35 100644 --- a/examples/shopping-cart/index.html +++ b/examples/shopping-cart/index.html @@ -3,9 +3,11 @@ vuex shopping cart example +
- + + diff --git a/examples/todomvc/main.js b/examples/todomvc/app.js similarity index 100% rename from examples/todomvc/main.js rename to examples/todomvc/app.js diff --git a/examples/todomvc/index.html b/examples/todomvc/index.html index d2a8c9cd7..ed4dd160c 100644 --- a/examples/todomvc/index.html +++ b/examples/todomvc/index.html @@ -6,6 +6,7 @@
- + + diff --git a/examples/webpack.build-all.config.js b/examples/webpack.build-all.config.js deleted file mode 100644 index d114f1132..000000000 --- a/examples/webpack.build-all.config.js +++ /dev/null @@ -1,40 +0,0 @@ -var path = require('path') - -var examples = [ - 'chat', - 'counter', - 'counter-hot', - 'shopping-cart', - 'todomvc' -] - -var entry = {} -examples.forEach(function (name) { - entry[name] = ['./examples/' + name + '/main.js'] -}) - -module.exports = { - entry: entry, - output: { - path: __dirname, - filename: '[name]/build.js' - }, - resolve: { - alias: { - vuex: path.resolve(__dirname, '../build/dev-entry') - } - }, - module: { - loaders: [ - { - test: /\.js$/, - loader: 'babel', - exclude: /node_modules|vue\/dist|vue-hot-reload-api|vue-loader/ - }, - { - test: /\.vue$/, - loader: 'vue' - } - ] - } -} diff --git a/examples/webpack.config.js b/examples/webpack.config.js new file mode 100644 index 000000000..e38ceb0e9 --- /dev/null +++ b/examples/webpack.config.js @@ -0,0 +1,46 @@ +const fs = require('fs') +const path = require('path') +const webpack = require('webpack') + +module.exports = { + + devtool: 'inline-source-map', + + entry: fs.readdirSync(__dirname).reduce((entries, dir) => { + const fullDir = path.join(__dirname, dir) + const entry = path.join(fullDir, 'app.js') + if (fs.statSync(fullDir).isDirectory() && fs.existsSync(entry)) { + entries[dir] = entry + } + + return entries + }, {}), + + output: { + path: path.join(__dirname, '__build__'), + filename: '[name].js', + chunkFilename: '[id].chunk.js', + publicPath: '/__build__/' + }, + + module: { + loaders: [ + { test: /\.js$/, exclude: /node_modules/, loader: 'babel' }, + { test: /\.vue$/, loader: 'vue' } + ] + }, + + resolve: { + alias: { + vuex: path.resolve(__dirname, '../build/dev-entry') + } + }, + + plugins: [ + new webpack.optimize.CommonsChunkPlugin('shared.js'), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development') + }) + ] + +} diff --git a/examples/webpack.shared.config.js b/examples/webpack.shared.config.js deleted file mode 100644 index 4f8c8d9ae..000000000 --- a/examples/webpack.shared.config.js +++ /dev/null @@ -1,28 +0,0 @@ -var path = require('path') - -module.exports = { - entry: './main.js', - output: { - path: process.cwd(), - filename: 'build.js' - }, - resolve: { - alias: { - vuex: path.resolve(__dirname, '../build/dev-entry') - } - }, - module: { - loaders: [ - { - test: /\.js$/, - loader: 'babel', - exclude: /node_modules|vue\/dist|vue-hot-reload-api|vue-loader/ - }, - { - test: /\.vue$/, - loader: 'vue' - } - ] - }, - devtool: '#source-map' -} diff --git a/package.json b/package.json index 494474425..418911d1a 100644 --- a/package.json +++ b/package.json @@ -9,19 +9,14 @@ "logger.js" ], "scripts": { - "counter": "cd examples/counter && webpack-dev-server --inline --hot --config ../webpack.shared.config.js", - "counter-hot": "cd examples/counter-hot && webpack-dev-server --inline --hot --config ../webpack.shared.config.js", - "todomvc": "cd examples/todomvc && webpack-dev-server --inline --hot --config ../webpack.shared.config.js", - "cart": "cd examples/shopping-cart && webpack-dev-server --inline --hot --config ../webpack.shared.config.js", - "chat": "cd examples/chat && webpack-dev-server --inline --hot --config ../webpack.shared.config.js", - "build": "node build/build.js", - "build-examples": "BABEL_ENV=development webpack --config examples/webpack.build-all.config.js", + "dev": "cd examples && webpack-dev-server --inline --hot --no-info", "test": "eslint src && npm run test:unit && npm run test:e2e", - "test:unit": "cross-env BABEL_ENV=development jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json", + "test:unit": "jasmine JASMINE_CONFIG_PATH=test/unit/jasmine.json", "test:e2e": "npm run build-examples && casperjs test --concise ./test/e2e", + "build": "node build/build.js", + "release": "bash build/release.sh", "docs": "cd docs && gitbook serve", - "deploy-docs": "cd docs && ./deploy.sh", - "release": "bash build/release.sh" + "docs:deploy": "cd docs && ./deploy.sh" }, "repository": { "type": "git",