Commit 2ad3279f1af243b5872319a96f73e583c5a550d4
1 parent
9f7f5145
Minify JSON localization files on a build stage.
Showing
3 changed files
with
28 additions
and
5 deletions
@@ -128,7 +128,8 @@ | @@ -128,7 +128,8 @@ | ||
128 | "webpack-dev-server": "^1.15.1", | 128 | "webpack-dev-server": "^1.15.1", |
129 | "webpack-hot-middleware": "^2.12.2", | 129 | "webpack-hot-middleware": "^2.12.2", |
130 | "webpack-material-design-icons": "^0.1.0", | 130 | "webpack-material-design-icons": "^0.1.0", |
131 | - "directory-tree": "^2.1.0" | 131 | + "directory-tree": "^2.1.0", |
132 | + "jsonminify": "^0.4.1" | ||
132 | }, | 133 | }, |
133 | "engine": "node >= 5.9.0", | 134 | "engine": "node >= 5.9.0", |
134 | "nyc": { | 135 | "nyc": { |
@@ -21,6 +21,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin'); | @@ -21,6 +21,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin'); | ||
21 | const webpack = require('webpack'); | 21 | const webpack = require('webpack'); |
22 | const path = require('path'); | 22 | const path = require('path'); |
23 | const dirTree = require('directory-tree'); | 23 | const dirTree = require('directory-tree'); |
24 | +const jsonminify = require("jsonminify"); | ||
24 | 25 | ||
25 | const PUBLIC_RESOURCE_PATH = '/'; | 26 | const PUBLIC_RESOURCE_PATH = '/'; |
26 | 27 | ||
@@ -55,8 +56,18 @@ module.exports = { | @@ -55,8 +56,18 @@ module.exports = { | ||
55 | moment: "moment" | 56 | moment: "moment" |
56 | }), | 57 | }), |
57 | new CopyWebpackPlugin([ | 58 | new CopyWebpackPlugin([ |
58 | - { from: './src/thingsboard.ico', to: 'thingsboard.ico' }, | ||
59 | - { from: './src/app/locale', to: 'locale' } | 59 | + { |
60 | + from: './src/thingsboard.ico', | ||
61 | + to: 'thingsboard.ico' | ||
62 | + }, | ||
63 | + { | ||
64 | + from: './src/app/locale', | ||
65 | + to: 'locale', | ||
66 | + ignore: [ '*.js' ], | ||
67 | + transform: function(content, path) { | ||
68 | + return Buffer.from(jsonminify(content.toString())); | ||
69 | + } | ||
70 | + } | ||
60 | ]), | 71 | ]), |
61 | new webpack.HotModuleReplacementPlugin(), | 72 | new webpack.HotModuleReplacementPlugin(), |
62 | new HtmlWebpackPlugin({ | 73 | new HtmlWebpackPlugin({ |
@@ -22,6 +22,7 @@ const CompressionPlugin = require('compression-webpack-plugin'); | @@ -22,6 +22,7 @@ const CompressionPlugin = require('compression-webpack-plugin'); | ||
22 | const webpack = require('webpack'); | 22 | const webpack = require('webpack'); |
23 | const path = require('path'); | 23 | const path = require('path'); |
24 | const dirTree = require('directory-tree'); | 24 | const dirTree = require('directory-tree'); |
25 | +const jsonminify = require("jsonminify"); | ||
25 | 26 | ||
26 | const PUBLIC_RESOURCE_PATH = '/static/'; | 27 | const PUBLIC_RESOURCE_PATH = '/static/'; |
27 | 28 | ||
@@ -53,8 +54,18 @@ module.exports = { | @@ -53,8 +54,18 @@ module.exports = { | ||
53 | moment: "moment" | 54 | moment: "moment" |
54 | }), | 55 | }), |
55 | new CopyWebpackPlugin([ | 56 | new CopyWebpackPlugin([ |
56 | - { from: './src/thingsboard.ico', to: 'thingsboard.ico'}, | ||
57 | - { from: './src/app/locale', to: 'locale' } | 57 | + { |
58 | + from: './src/thingsboard.ico', | ||
59 | + to: 'thingsboard.ico' | ||
60 | + }, | ||
61 | + { | ||
62 | + from: './src/app/locale', | ||
63 | + to: 'locale', | ||
64 | + ignore: [ '*.js' ], | ||
65 | + transform: function(content, path) { | ||
66 | + return Buffer.from(jsonminify(content.toString())); | ||
67 | + } | ||
68 | + } | ||
58 | ]), | 69 | ]), |
59 | new HtmlWebpackPlugin({ | 70 | new HtmlWebpackPlugin({ |
60 | template: './src/index.html', | 71 | template: './src/index.html', |