uglify没有使用gulp

时间:2018-01-04 18:59:32

标签: gulp gulp-uglify

我有一个像这样的基本脚本

var gulp = require('gulp');
var uglify = require('gulp-uglify');

gulp.task('default',function(){
    return gulp.src('homeScreen/*.js')
    .pipe(uglify())
    .pipe(gulp.dest('dist'));
});

我在尝试uglify js代码。但无论出于何种原因,它都没有发生。它出现在单行中,但仍然可读。

我已经安装了gulp,像这样uglify

npm install gulp --save
npm install gulp-uglify --save

有人可以说出了什么问题吗?

输出

- 预

$(document).ready(function() {

  $(".coins").animate({ "left": "00px" }, "slow" );
  $(".volumnControls").animate({ "left": "00px" }, "slow" );

  $('#volumnOff').hide();

    $('#volumnOn,#volumnOff').click(function(){
      $('#volumnOn,#volumnOff').toggle();
      playAndPause();
    });



    $('#store').click(function(){
      window.location = '../shop/shopHome.html';
    });


    $('#howToPlay,.close').click(function()
    {
         $('#myModal').toggleClass('modalAppear modalDisAppear'); //Adds 'a', removes 'b' and vice versa
         $('.close').css('display','none'); //Adds 'a', removes 'b' and vice versa
    });

    $('.next-controls').click(function(){
      $('.close').css('display','inline-block'); //Adds 'a', removes 'b' and vice versa
      $('.next-controls').css('display','none'); //Adds 'a', removes 'b' and vice versa
      $('.slide-text').css('display','none');
    });

    $('.close').click(function(){
      $('.next-controls').css('display','inline-block'); //Adds 'a', removes 'b' and vice versa
        $('.slide-text').css('display','inline-block');
    });

});

- 发布

$(document).ready(function(){$(".coins").animate({left:"00px"},"slow"),$(".volumnControls").animate({left:"00px"},"slow"),$("#volumnOff").hide(),$("#volumnOn,#volumnOff").click(function(){$("#volumnOn,#volumnOff").toggle(),playAndPause()}),$("#store").click(function(){window.location="../shop/shopHome.html"}),$("#howToPlay,.close").click(function(){$("#myModal").toggleClass("modalAppear modalDisAppear"),$(".close").css("display","none")}),$(".next-controls").click(function(){$(".close").css("display","inline-block"),$(".next-controls").css("display","none"),$(".slide-text").css("display","none")})

0 个答案:

没有答案