chyingp / grunt-inline

Brings externally referenced resources, such as js, css and images, into a single file.
MIT License
87 stars 55 forks source link

Uglify doesn't remove JS comments #45

Open doublejosh opened 9 years ago

doublejosh commented 9 years ago

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

chyingp commented 9 years ago

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

doublejosh commented 9 years ago

:smiley:

chyingp commented 9 years ago

@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');
};
doublejosh commented 9 years ago

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'
  ]