缩小从javascripts中删除分号

时间:2017-05-21 12:41:39

标签: javascript minify

稍后补充:我想进一步澄清我的担忧。我担心的是没有分号工作的未缩小代码。 但是在缩小代码中没有分号(单行)?因为它表示声明的结尾。

我也经历了这个问题的答案https://stackoverflow.com/questions/5840845/reliable-and-convenient-javascript-minifier#=

我也经历过stephenwlther链接。

但我的担忧仍未得到解决。因为minifier工具从许多行中删除分号。

检查这个未缩小的代码......

(jQuery)(function ($) {

function statsCount(options) {
    var $this = $(this);
    options = $.extend({}, options || {}, $this.data('countToOptions') ||        {});
    $this.countTo(options);
} // NUMBERS COUNTER END

function statsAnimate() {
    // NUMBERS COUNTER START
    $('.numbers').data('countToOptions', {
        formatter: function (value, options) {
            return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, ',');
        }
    });
    // start timer
    $('.timer').each(statsCount);
}

if (typeof (CMA) != "undefined" && CMA.elementsAnimation) {
    $('.numbers-counter').waypoint(function () {
        statsAnimate();
    },
            {offset: '70%'}
    );
} else {
    statsAnimate();
}
});

minifier.org给我下面的代码......

(jQuery)(function($){function statsCount(options){var $this=$(this);options=$.extend({},options||{},$this.data('countToOptions')||});$this.countTo(options)}function statsAnimate()$('.numbers').data('countToOptions',formatter:function(value,options){return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g,',')}});$('.timer').each(statsCount)}if(typeof(CMA)!="undefined"&&CMA.elementsAnimation){$('.numbers-counter').waypoint(function()statsAnimate()},offset:'70%'})}else{statsAnimate()}})

请注意最后和很多地方没有分号。

如果这是正确的??

0 个答案:

没有答案