Skip to content

Rename function is ignored #204

@llech

Description

@llech

I have a simple grunt build where I want to add files from main directory into zip, and additionally add minified javascript resurce from build directory. The config looks following:

module.exports = function(grunt) {

  grunt.initConfig({
	  uglify: {
      	target: {
      		files: {
      			'build/js/app.js': ['js/app.js']
			}
		}
	  },
	  compress: {
		main : {
			options: {
				archive: 'build/archive.zip',
				mode: 'zip'
			},
			files: [
				{ src: 'js/**' },
				{ src: 'build/js/**',
					rename: function(dest, src) {
                        grunt.log.writeln('rename')
						return dest + src.replace('build/js', 'js')
					}
				},
			]
		}
	  },  
  });

  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-compress');

  grunt.registerTask('dist', ['uglify','compress']);

};	  

I'm running grunt using npm. I refer version 1.4.1 of grunt-contrib-compress.

The problem is, that the rename function is silently ignored. The log message is not written, and the build/js files land under build/js in my zip, and not in js/ as I'd expect.

The documentation is vague, but it mentions using rename in examples in similar way, so I'd expect it to work. It does not, so I'm assuming it's a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions