如何缩小js文件的大小? [英] How to unminify the js files?

查看:395
本文介绍了如何缩小js文件的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何取消最小化来自webpack工具的js文件.

How can I unminify js file which is minify from webpack tool.

缩小之前,

function autoslideSlider() {
  $('.next-slide').trigger('click');
}
$(window).on('load', function(){
  $('.preloader').fadeOut('fast');
     $('#after_load').addClass('show');
     setInterval(autoslideSlider, 8000);
});
$('a').on('click', function () {
    if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) {
        var $target = $(this.hash);
        $target = $target.length && $target;
        // $('[name=' + this.hash.slice(1) + ']');
        if ($target.length) {
            var targetOffset = $target.offset().top - 20;
            $('html,body').animate({
                scrollTop: targetOffset
            }, 1500);
            return false;
        }
    }
});

缩小后

!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:o})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t){function n(){$(".next-slide").trigger("click")}$(window).on("load",function(){$(".preloader").fadeOut("fast"),$("#after_load").addClass("show"),setInterval(n,8e3)}),$("a").on("click",function(){if(location.pathname.replace(/^\//,"")===this.pathname.replace(/^\//,"")&&location.hostname===this.hostname){var e=$(this.hash);if((e=e.length&&e).length){var t=e.offset().top-20;return $("html,body").animate({scrollTop:t},1500),!1}}})}]);

如何缩小上面的js文件?

How can I unminify the above js file?

我希望缩小的js文件恢复为原始格式.

I want minified js file back into original format.

有人可以告诉我取消js文件最小化的工具或方法吗?

Can anyone tell me the tools or way to unminify the js file?

谢谢.

推荐答案

您无法取消缩小文件的大小.缩小是一种破坏性的操作,涉及信息丢失.

You can't unminify a minified file. Minification is a desctructive operation and involves loss of information.

例如,如果您有一个带有描述性名称的函数,则在最小化后,该名称将被无意义的名称替代.无法撤消此操作.

For example, if you have a function with a descriptive name, after minifcation that name will be substitute with a meaningless one. There's no way to go back from this operation.

您可以使用美化器使其更具可读性,但是您将在其中进行繁重的逆向工程以便了解代码的含义.

You can use a beautifier to make it more readable, but you will have a weighty job of reverse engineering in order to understand what the code means.

这篇关于如何缩小js文件的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆