diff client/vue.config.js @ 568:99968a7394f7

feat: PurgeCSS added to remove unnecessary CSS weight For more info see: https://github.com/FullHuman/purgecss
author Thomas Junk <thomas.junk@intevation.de>
date Wed, 05 Sep 2018 10:43:05 +0200
parents f6d61657b487
children 8278b2fb0c33
line wrap: on
line diff
--- a/client/vue.config.js	Tue Sep 04 21:41:45 2018 +0200
+++ b/client/vue.config.js	Wed Sep 05 10:43:05 2018 +0200
@@ -1,4 +1,7 @@
-var CopyWebpackPlugin = require("copy-webpack-plugin");
+const CopyWebpackPlugin = require("copy-webpack-plugin");
+const PurgecssPlugin = require("purgecss-webpack-plugin");
+const glob = require("glob-all");
+const path = require("path");
 
 module.exports = {
   outputDir: "../web",
@@ -10,6 +13,15 @@
       .use(CopyWebpackPlugin, [[{ from: vendorImgPath, to: "img" }]], {
         copyUnmodified: true
       });
+    config.plugin("PurgecssPlugin").use(PurgecssPlugin, [
+      {
+        paths: glob.sync([
+          path.join(__dirname, "./src/index.html"),
+          path.join(__dirname, "./**/*.vue"),
+          path.join(__dirname, "./src/**/*.js")
+        ])
+      }
+    ]);
   },
   devServer: {
     proxy: {