tdewolff / minify

Go minifiers for web formats

Home Page:https://go.tacodewolff.nl/minify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Minified date file has to be the newest of input files

espinosa opened this issue · comments

Actually, when I minify, the minified file has the date of the first input file.
Can you set the date of the newest file input ?

I agree that it shouldn't be plainly the first input that dictates the date, but I'd argue it should be the newest date of all inputs, and not the oldest. The newest date reflects the last date it was modified, and so was the minified result modified at that same date for the last time as well.

What use-case do you have that requires the oldest date?

You are right, it's the newest, not the oldest. I have changed the issue.

This only affects when using --bundle but isn't trivial to solve. For one, the file permissions and ownership preservation may not work for --bundle if the files have different permissions/ownership values. Should we just pick the first source file? For modification time we pick the latest (newest), but what about access time, should we pick the latest (newest) too?

But crucially, what about the parent directories? If we have two input files, one deeper nested than the other, how do we set the file attributes on the output directories that are created?

I've implemented this to throw a warning if ownership/permissions differ between input files, and pick the latest atime/mtime. For the parent directories I'll only use the first input file (not sure if this is correct).

Disregard that last statement. There are no destination directories created corresponding to source directories, so this doesn't apply. It will only preserve the file when using --bundle.

This issue is now fixed, please let me know if it works well for you.

Thanks for the quick change