grunt-inline icon indicating copy to clipboard operation
grunt-inline copied to clipboard

Uglify doesn't remove JS comments

Open doublejosh opened this issue 10 years ago • 4 comments
trafficstars

Setting uglify: true does not seem to remove comments when inlined.

doublejosh avatar Dec 19 '14 23:12 doublejosh

@doublejosh sorry for replying late. I will take care of it soon :)

chyingp avatar Jan 09 '15 06:01 chyingp

:smiley:

doublejosh avatar Jan 09 '15 08:01 doublejosh

@doublejosh

What's your configuration like? I need more detail to look into your issue :)

I try inlining a script file, and set uglify:true, which compressed the script file, including removing the comments as expected.

Here is the configuration I use:

module.exports = function(grunt) {
    grunt.initConfig({
        inline: {           
            dev: {
                options: {
                    uglify: true
                },
                src: 'temp/error.html',
                dest: 'temp/errors.html'
            }
        }
    });

    grunt.loadNpmTasks('grunt-inline');
};

chyingp avatar Jan 09 '15 15:01 chyingp

Pretty simple, options set in the task, in coffeescript...

  grunt.initConfig
...
    inline:
      options:
        cssmin: true
        uglify: true
      src: [
        '<%= config.dist %>/asset/*',
        '<%= config.dist %>/trial/*'
      ]
...
  grunt.registerTask 'default', [
    'clean'
    'jshint'
    'copy'
    'concat'
    'compress'
    'inline'
    'cacheBust'
  ]

doublejosh avatar Jan 09 '15 22:01 doublejosh