捆绑并缩小kendo-ui

时间:2018-10-15 14:59:41

标签: javascript webpack kendo-ui

我已经在NPM上安装了@ progress / kendo-ui,并且使用WEBPACK捆绑了我需要使用的文件,GRID和COMBOBOX,但是到目前为止,我无法缩小从WEBPACK获得的文件。我认为这两个文件都太长。这是我的配置文件,用于获取GRID和COMBOBOX捆绑包及其CSS和图像:

** appJS.js

$ = require('jquery');
require("@progress/kendo-ui/js/kendo.grid.js");
require("@progress/kendo-ui/js/kendo.combobox.js");

** appCSS.js

require("@progress/kendo-ui/css/web/kendo.common.min.css");
require("@progress/kendo-ui/css/web/kendo.default.min.css");
require("@progress/kendo-ui/css/web/kendo.default.mobile.min.css");

** webpack.config.js

var path = require('path');
var UglifyJsPlugin = require("uglifyjs-webpack-plugin");

module.exports = {
    entry: {
        main: './Scripts/appJS',
        css: './Scripts/appCSS'
    },

    output: {
        publicPath: "/js/",
        path: path.join(__dirname, '/wwwroot/js/'),
        filename: '[name].kendo.builds.js'
    },

    optimization: {
        minimizer: [
            new UglifyJsPlugin({
                cache: true,
                parallel: true
            })
        ]
    },

    module: {
        rules: [
            {
                test: /\.css$/,
                use: [
                    { loader: 'style-loader' },
                    { loader: 'css-loader' }
                ]
            },
            {
                test: /\.(svg|gif|png|eot|woff|ttf)$/,
                use: [
                    { loader: 'url-loader' }
                ]
            }
        ]
    }
};

通过这种配置,我得到了两个文件main.kendo.builds.js和css.kendo.builds.js。主文件为998 KB,css为8954 KB。

我应该怎么做才能获得缩小格式????

0 个答案:

没有答案