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

When src filenames use the same name but different extension, gzip dest is wrong #70

Closed
laurentperez opened this issue Nov 12, 2013 · 4 comments

Comments

@laurentperez
Copy link

Hi

Given two files, one.js and one.min.js, with the code

        compress: {
            main: {
                options: {
                    mode: 'gzip'
                },
                files: [
                    {expand: true,
                        src: ['one.js', 'one.min.js'], dest: '../../assets/javascript', ext: '.js'}
                ]
            }
        },

Then it will create only one gzip file, not two. It's confused by the "min" name.

Running "compress:main" (compress) task
Created ../../assets/javascript/one.js.gz (20 bytes)
Created ../../assets/javascript/one.js.gz (20 bytes)
@tkellen
Copy link
Member

tkellen commented Nov 13, 2013

Thanks for the heads up! I'm going to close this here and open an issue on the Grunt tracker because this is an issue with our declarative file expansion methods, not this task.

@tkellen tkellen closed this as completed Nov 13, 2013
@tkellen
Copy link
Member

tkellen commented Nov 13, 2013

In the meantime, you can resolve this by using the rename method:
http://stackoverflow.com/questions/16697344/configure-grunt-file-name-matching-for-files-with-multiple-dots

@laurentperez
Copy link
Author

Thanks. Unfortunately even using a rename, the src is already wrong.

  {expand: true,
                        src: ['one', 'one.min.js', 'foo'], dest: '../../assets/javascript', rename: function(dest, src){
                        grunt.log.writeln("dest:" + dest + "!");
                        grunt.log.writeln("src:" + src + "!");
                        return dest + src;
                    }}

Will miss the first one

Running "compress:main" (compress) task
dest:../../assets/javascript!
src:one.min.js!
dest:../../assets/javascript!
src:foo!
Created ../../assets/javascriptone.min.js.gz (20 bytes)

So, I renamed the files myself.

@laurentperez
Copy link
Author

Hmm in fact it somehow works, you have to make sure filenames have an extension

src: ['one', 'one.min.js', 'foo'] is ko
src: ['one.js', 'one.min.js', 'foo'] is ok, the src rename parameter will use one.js and one.min.js

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