Minify JSON localization files on a build stage.
This commit is contained in:
		
							parent
							
								
									9f7f5145ee
								
							
						
					
					
						commit
						2ad3279f1a
					
				@ -128,7 +128,8 @@
 | 
			
		||||
    "webpack-dev-server": "^1.15.1",
 | 
			
		||||
    "webpack-hot-middleware": "^2.12.2",
 | 
			
		||||
    "webpack-material-design-icons": "^0.1.0",
 | 
			
		||||
    "directory-tree": "^2.1.0"
 | 
			
		||||
    "directory-tree": "^2.1.0",
 | 
			
		||||
    "jsonminify": "^0.4.1"
 | 
			
		||||
  },
 | 
			
		||||
  "engine": "node >= 5.9.0",
 | 
			
		||||
  "nyc": {
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
 | 
			
		||||
const webpack = require('webpack');
 | 
			
		||||
const path = require('path');
 | 
			
		||||
const dirTree = require('directory-tree');
 | 
			
		||||
const jsonminify = require("jsonminify");
 | 
			
		||||
 | 
			
		||||
const PUBLIC_RESOURCE_PATH = '/';
 | 
			
		||||
 | 
			
		||||
@ -55,8 +56,18 @@ module.exports = {
 | 
			
		||||
            moment: "moment"
 | 
			
		||||
        }),
 | 
			
		||||
        new CopyWebpackPlugin([
 | 
			
		||||
            { from: './src/thingsboard.ico', to: 'thingsboard.ico' },
 | 
			
		||||
            { from: './src/app/locale', to: 'locale' }
 | 
			
		||||
            {
 | 
			
		||||
                from: './src/thingsboard.ico',
 | 
			
		||||
                to: 'thingsboard.ico'
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                from: './src/app/locale',
 | 
			
		||||
                to: 'locale',
 | 
			
		||||
                ignore: [ '*.js' ],
 | 
			
		||||
                transform: function(content, path) {
 | 
			
		||||
                    return Buffer.from(jsonminify(content.toString()));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        ]),
 | 
			
		||||
        new webpack.HotModuleReplacementPlugin(),
 | 
			
		||||
        new HtmlWebpackPlugin({
 | 
			
		||||
 | 
			
		||||
@ -22,6 +22,7 @@ const CompressionPlugin = require('compression-webpack-plugin');
 | 
			
		||||
const webpack = require('webpack');
 | 
			
		||||
const path = require('path');
 | 
			
		||||
const dirTree = require('directory-tree');
 | 
			
		||||
const jsonminify = require("jsonminify");
 | 
			
		||||
 | 
			
		||||
const PUBLIC_RESOURCE_PATH = '/static/';
 | 
			
		||||
 | 
			
		||||
@ -53,8 +54,18 @@ module.exports = {
 | 
			
		||||
            moment: "moment"
 | 
			
		||||
        }),
 | 
			
		||||
        new CopyWebpackPlugin([
 | 
			
		||||
            { from: './src/thingsboard.ico', to: 'thingsboard.ico'},
 | 
			
		||||
            { from: './src/app/locale', to: 'locale' }
 | 
			
		||||
            {
 | 
			
		||||
                from: './src/thingsboard.ico',
 | 
			
		||||
                to: 'thingsboard.ico'
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                from: './src/app/locale',
 | 
			
		||||
                to: 'locale',
 | 
			
		||||
                ignore: [ '*.js' ],
 | 
			
		||||
                transform: function(content, path) {
 | 
			
		||||
                    return Buffer.from(jsonminify(content.toString()));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        ]),
 | 
			
		||||
        new HtmlWebpackPlugin({
 | 
			
		||||
            template: './src/index.html',
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user