Not a bug build.json - minify "*" step does not skip minified files (if the full version exists)

Xon

Well-known member
Affected version
2.0.9
If you have;
  • foo.js
  • foo.min.js
The minify step using "*" (rather than an explicit array list) will reprocess "foo.js" into "foo.min.js"
 
To be honest, I feel like this is probably safer. Although we can check for the existence of the .min.js file we can't know for sure whether the full JS has had any changes since it was last minified.

I'm assuming perhaps that the foo.min.js file in this case is a vendor library? FWIW, I tend to never include minified files in my development project and just let the build release process to create the minified versions. Then I use dev/prod attributes on the xf:js tag so that in dev the full versions are called and in prod the minified versions are called.

Or is there another use case I'm overlooking here?
 
Yes, it was mostly about vendor pre-minified files not wanting to re-touch them.

It would be nice if the minify "*" had glob support so you could minify some folders and not others, so I can leave vendor files along but only minify add-on assets.

But this rapidly starts writing a complex build process, so you need to draw the line somewhere!
 
Yeah there’s a certain elegance to the simplicity of it at the moment and I do think the question as to whether the minified file is up to date is a valid one.

On this occasion, I think it’s best to just not include the minified files in your dev environment. Although it gives more work for the build process to do, it removes the concern that the existing minified file could be outdated.
 
Back
Top Bottom