diff --git a/.babelrc b/.babelrc index cd9c654..342548f 100644 --- a/.babelrc +++ b/.babelrc @@ -3,7 +3,16 @@ ["env", { "modules": false }], "stage-2" ], - "plugins": ["transform-runtime"], + "plugins": [ + "add-filehash", + ["transform-imports", { + "vuetify": { + "transform": "vuetify/src/components/${member}", + "preventFullImport": true + } + }], + "transform-runtime" + ], "comments": false, "env": { "test": { @@ -11,4 +20,4 @@ "plugins": ["istanbul", "syntax-dynamic-import"] } } -} \ No newline at end of file +} diff --git a/assets/app.js b/assets/app.js index 3a5f5ad..6a51028 100644 --- a/assets/app.js +++ b/assets/app.js @@ -1,6 +1,5 @@ import Vue from 'vue' import App from './App.vue' -import Vuetify from 'vuetify' import VueClipboards from 'vue-clipboards' import VueLazyload from 'vue-lazyload' @@ -10,7 +9,44 @@ import { createStore } from 'store/index' import { createRouter } from 'router/index' import { sync } from 'vuex-router-sync' -Vue.use(Vuetify) +import { + Vuetify, + VApp, + VSelect, + VMenu, + VList, + VNavigationDrawer, + VToolbar, + VSystemBar, + VSubheader, + VFooter, + VBtn, + VIcon, + VSnackbar, + VCard, + VDialog, + VTextField +} from 'vuetify' + +Vue.use(Vuetify, { + components: { + VApp, + VSelect, + VMenu, + VList, + VNavigationDrawer, + VToolbar, + VSystemBar, + VSubheader, + VFooter, + VBtn, + VIcon, + VSnackbar, + VCard, + VDialog, + VTextField + } +}) Vue.use(VueClipboards) Vue.use(VueLazyload, { preLoad: 1.3, diff --git a/assets/stylus/main.styl b/assets/stylus/main.styl index de9230b..83c4419 100644 --- a/assets/stylus/main.styl +++ b/assets/stylus/main.styl @@ -10,11 +10,11 @@ $theme := { warning: #0D47A1 error: #B71C1C success: #2E7D32 - mablue: #0D47A1, + mablue: #0D47A1 dark: #424242 } -@import '../../node_modules/vuetify/src/stylus/main' +@import '../../node_modules/vuetify/src/stylus/app' /** Transitions diff --git a/package.json b/package.json index 46c2558..7c81ab4 100644 --- a/package.json +++ b/package.json @@ -37,6 +37,7 @@ "animate.css": "^3.5.2", "axios": "^0.16.2", "babel-core": "^6.25.0", + "babel-plugin-transform-object-rest-spread": "^6.26.0", "babel-runtime": "^6.25.0", "chalk": "^2.0.1", "colors": "^1.1.2", @@ -57,7 +58,7 @@ "vue-loader": "^13.0.4", "vue-router": "^2.7.0", "vue-server-renderer": "^2.4.2", - "vuetify": "^0.15.0-beta.2", + "vuetify": "^0.15.0-beta.4", "vuex": "^2.3.1", "vuex-router-sync": "^4.1.2" }, @@ -66,8 +67,10 @@ "ava": "^0.19.1", "babel-eslint": "^7.2.3", "babel-loader": "^7.0.0", + "babel-plugin-add-filehash": "^6.9.4", "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-syntax-dynamic-import": "^6.18.0", + "babel-plugin-transform-imports": "^1.4.1", "babel-plugin-transform-runtime": "^6.22.0", "babel-polyfill": "^6.23.0", "babel-preset-env": "^1.3.2", @@ -92,6 +95,7 @@ "html-webpack-plugin": "^2.29.0", "nightwatch": "^0.9.15", "nyc": "^10.3.2", + "optimize-css-assets-webpack-plugin": "^3.1.1", "pre-commit": "^1.2.2", "pug": "^2.0.0-rc.3", "rimraf": "^2.6.1", diff --git a/webpack/webpack.base.config.js b/webpack/webpack.base.config.js index bd44500..bb1c189 100644 --- a/webpack/webpack.base.config.js +++ b/webpack/webpack.base.config.js @@ -5,32 +5,33 @@ const vueConfig = require('./vue-loader.config') const ExtractTextPlugin = require('extract-text-webpack-plugin') const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') const ProgressBarPlugin = require('progress-bar-webpack-plugin') +const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') const isDev = process.env.NODE_ENV === 'development' -const resolve = (file) => path.resolve(__dirname, file) +const resolve = (file) => path.resolve(__dirname, '..', file) module.exports = { devtool: !isDev ? false : '#cheap-module-source-map', output: { - path: resolve('../public'), + path: resolve('public'), publicPath: '/public/', filename: '[name].[chunkhash].js' }, resolve: { extensions: ['*', '.js', '.json', '.vue'], alias: { - 'assets': resolve('../assets'), - 'components': resolve('../components'), - 'examples': resolve('../pages/examples'), - 'layouts': resolve('../layouts'), - 'mixins': resolve('../mixins'), - 'pages': resolve('../pages'), - 'public': resolve('../public'), - 'router': resolve('../router'), - 'static': resolve('../static'), - 'store': resolve('../store'), + 'assets': resolve('assets'), + 'components': resolve('components'), + 'examples': resolve('pages/examples'), + 'layouts': resolve('layouts'), + 'mixins': resolve('mixins'), + 'pages': resolve('pages'), + 'public': resolve('public'), + 'router': resolve('router'), + 'static': resolve('static'), + 'store': resolve('store'), 'vue$': 'vue/dist/vue.common.js' } }, @@ -40,12 +41,27 @@ module.exports = { { test: /\.vue$/, loader: 'vue-loader', - options: vueConfig + options: vueConfig, + include: [ + resolve('assets/App.vue'), + resolve('pages'), + resolve('components'), + resolve('node_modules/vuetify') + ] }, { test: /\.js$/, loader: 'babel-loader', - exclude: /node_modules/ + exclude: /node_modules/, + include: [ + resolve('components/_index.js'), + resolve('mixins'), + resolve('store'), + resolve('router'), + resolve('server'), + resolve('assets'), + resolve('node_modules/vuetify') + ] }, { test: /\.styl$/, @@ -81,6 +97,12 @@ module.exports = { new ExtractTextPlugin({ filename: 'common.[chunkhash].css' }), + new OptimizeCSSPlugin({ + cssProcessorOptions: { + safe: true, + discardComments: { removeAll: true } + } + }), new ProgressBarPlugin({ format: chalk.cyan('> build') + ' [:bar] ' + chalk.green.bold(':percent') + ' (:elapsed seconds)', clear: true