armin-pfaeffle / atom-minify

Minifies JS and CSS files, optionally on save ‒ package for atom.io
https://atom.io/packages/atom-minify
MIT License
24 stars 7 forks source link

Add option to rev filenames #32

Open Nfinished opened 8 years ago

Nfinished commented 8 years ago

Either as a string variable or setting, it'd be nice to have the option to rev filenames to prevent browser caching when needed.

ex: scripts.min.js

becomes

dd32efhs.min.js

armin-pfaeffle commented 8 years ago

Nice idea!

But before, we have to discuss some features:

Nfinished commented 8 years ago

Those are some really good points.

A separate approach could be following the ?v=n pattern and just updating the src by the method in my third bullet point, but at that point it's starting to sound like its own separate package. Maybe that's the real answer.

armin-pfaeffle commented 8 years ago

In my mind, older versions would be replaced by the new file, I can't imagine a reason to keep outdated minified files around.

In general, you are right. But what if some browser has cached a HTML file that points to the old version of a CSS file? For my package it would be easier to keep old versions, but manually removing them is problematic. There should be a file history and my package should keep only the last N versions -- N is customizable, so you can set it so 1, too!

This is probably the biggest roadblock. as far as automation goes, I can imagine a (required) inline option to direct the minifier to the files containing strings it may need to update, though that could get messy very quickly.

Yep! I think so, too!

Probably a separate package is the best answer. But first, I should implement a inter-package-communication interface. Then I could outsource more options and implement features like this one.

I push that on my todo list!