diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 5aec2faf..ab6d64b8 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -6,6 +6,7 @@ var merge = require('webpack-merge') var baseWebpackConfig = require('./webpack.base.conf') var HtmlWebpackPlugin = require('html-webpack-plugin') var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') +var dependencies = require('../package.json').dependencies // add hot-reload related code to entry chunks Object.keys(baseWebpackConfig.entry).forEach(function (name) { @@ -27,7 +28,8 @@ module.exports = merge(baseWebpackConfig, { cache: true, plugins: [ new webpack.DefinePlugin({ - 'process.env': config.dev.env + 'process.env': config.dev.env, + 'DEPENDENCIES': JSON.stringify(dependencies) }), // https://github.com/glenjamin/webpack-hot-middleware#installation--usage new webpack.HotModuleReplacementPlugin(), diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js index 5a2b0b2d..3c000b7d 100644 --- a/build/webpack.prod.conf.js +++ b/build/webpack.prod.conf.js @@ -8,6 +8,7 @@ var CopyWebpackPlugin = require('copy-webpack-plugin') var HtmlWebpackPlugin = require('html-webpack-plugin') var ExtractTextPlugin = require('extract-text-webpack-plugin') var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') +var dependencies = require('../package.json').dependencies var env = config.build[process.env.env_config+'Env'] @@ -33,7 +34,8 @@ var webpackConfig = merge(baseWebpackConfig, { new webpack.optimize.ModuleConcatenationPlugin(), // http://vuejs.github.io/vue-loader/en/workflow/production.html new webpack.DefinePlugin({ - 'process.env': env + 'process.env': env, + 'DEPENDENCIES': JSON.stringify(dependencies) }), new webpack.optimize.UglifyJsPlugin({ compress: { diff --git a/src/components/ThemePicker/index.vue b/src/components/ThemePicker/index.vue new file mode 100644 index 00000000..5512d28c --- /dev/null +++ b/src/components/ThemePicker/index.vue @@ -0,0 +1,145 @@ + + + + + diff --git a/src/utils/index.js b/src/utils/index.js index 2140fdff..dccca0ca 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -265,3 +265,8 @@ export function deepClone(source) { } return targetObj } + +// get dependencies verison from package.json by webpack.DefinePlugin +export function getVersion(name) { + return DEPENDENCIES[name] // eslint-disable-line +} diff --git a/src/views/layout/components/Navbar.vue b/src/views/layout/components/Navbar.vue index 54b9b343..26fc67a3 100644 --- a/src/views/layout/components/Navbar.vue +++ b/src/views/layout/components/Navbar.vue @@ -1,47 +1,64 @@ + + + +