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

Wrong paths in grunt.filerev.summary when a cwd was defined

Open binarykitchen opened this issue 11 years ago • 7 comments

Okay, next one:

When I have this grunt config

        filerev: {
            images: {
                expand: true,
                cwd: 'client',
                src: 'images/site/**/*.*',
                dest: 'server/public
            }

Then we have those entries in grunt.filerev.summary:

{ 
  'client/images/site/btn/facebook-login-btn.png': 'server/public/images/site/btn/facebook-login-btn.7e70e4e8.png',
  'client/images/site/btn/facebook-signup-btn.png': 'server/public/images/site/btn/facebook-signup-btn.071c597b.png',
  'client/images/site/btn/google-login-btn.png': 'server/public/images/site/btn/google-login-btn.d8f30867.png',
  'client/images/site/btn/google-signup-btn.png': 'server/public/images/site/btn/google-signup-btn.5df3ce2e.png'
}

But I do not want the client part in them. Because of the cwd option. Same goes with the destination part, server/public should not be here. Ideally I want something like this:

Then we have those entries in grunt.filerev.summary:

{ 
  'images/site/btn/facebook-login-btn.png': 'images/site/btn/facebook-login-btn.7e70e4e8.png',
  'images/site/btn/facebook-signup-btn.png': 'images/site/btn/facebook-signup-btn.071c597b.png',
  'images/site/btn/google-login-btn.png': 'images/site/btn/google-login-btn.d8f30867.png',
  'images/site/btn/google-signup-btn.png': 'images/site/btn/google-signup-btn.5df3ce2e.png'
}

binarykitchen avatar Dec 20 '13 00:12 binarykitchen

If I could only figure out how to access cwd, I would push a patch myself.

ProLoser avatar Feb 05 '14 22:02 ProLoser

@binarykitchen I'm assuming you're using this alongside usemin?

ProLoser avatar Feb 05 '14 22:02 ProLoser

@ProLoser Usemin? Since I have no idea what usemin is, I guess I am not using usemin at all.

binarykitchen avatar Feb 06 '14 00:02 binarykitchen

I can confirm this issue. +1

cemo avatar May 24 '14 09:05 cemo

I think it had to be resolved with an option flag so it maintains backwards capability.

sladex avatar Sep 09 '14 09:09 sladex

@binarykitchen@eddiemonge I think it should be better to add a basename option provide a map, with the key being the original basename, and the value being the revved basename. This option should be by default set to false. And maybe with could add an other option to specify a path, but I think it would go beyond the scope of filerev.

FYI there is the richardbolt/grunt-filerev-assets which should help you.

stephanebachelier avatar Oct 27 '14 01:10 stephanebachelier

:+1: Not sure how people are using usemin + filerev with this issue

fenduru avatar Dec 06 '14 21:12 fenduru