sebdeckers / grunt-rev

:punch: Asset revving for Grunt.js
MIT License
240 stars 54 forks source link

After setting 'md5', 'utf8' and length:8 options, the hashed filename is not always same whilethe file content is always same. #13

Closed ghosert closed 11 years ago

ghosert commented 11 years ago

The Gruntfile.js looks like this:

rev: {
    options: {
      encoding: 'utf8',
      algorithm: 'md5',
      length: 8
    },
    files: {
        src: [
          'assets/**/*'
        ]
    }
}

I got this on Sep 2:

-rw-rw-r-- 1 jiawzhang jiawzhang 166023 Sep 2 20:41 1ea21eb3.mdeditor.lib.min.css -rw-rw-r-- 1 jiawzhang jiawzhang 421621 Sep 2 20:41 428a0363.mdeditor.lib.min.js -rw-rw-r-- 1 jiawzhang jiawzhang 4516 Sep 2 20:41 be425dd2.mdeditor.min.css

And then I got this on Sep 3:

-rw-rw-r-- 1 jiawzhang jiawzhang 4516 Sep 3 09:40 1493dd1f.mdeditor.min.css -rw-rw-r-- 1 jiawzhang jiawzhang 421621 Sep 3 09:40 3c69ae34.mdeditor.lib.min.js -rw-rw-r-- 1 jiawzhang jiawzhang 166023 Sep 3 09:40 6343279f.mdeditor.lib.min.css

You could see the file size is same and I'm sure the content is same as well, but the hashed file name had been changed curiously.

ghosert commented 11 years ago

Close this invalid bug, the root cause is that the file is generated by cssmin/uglify, they have the options for banner like <%=grunt.template.today('yyyy-mm-dd') %>, So the file size is not changed, but the file content does based on the current date.

Sorry for spam.