Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename function is ignored #204

Open
llech opened this issue Feb 8, 2018 · 1 comment
Open

Rename function is ignored #204

llech opened this issue Feb 8, 2018 · 1 comment

Comments

@llech
Copy link

llech commented Feb 8, 2018

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.

@utdrmac
Copy link

utdrmac commented Feb 23, 2018

I'm just trying to rename a single file when it is added to the archive, but that doesn't work either:

{ src: 'ebextensions', dest: '', rename: '.ebextensions' },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants