mardi 30 décembre 2014

Hash web resource file names, and update JSP files

I like to hash my web resources (CSS, JS, Images) so it will be saved in the browser cache and change only when the version changed.


I found a few GRUNT modules that let you hash your files, and create JSON file for you. The JSON file looks like {"oldFileName1": "newFileName1", "oldFileName2": "newFileName2"} and so own.


Now the second part is to update my JSP files with the new file names. How do you think I should to do it? One way, because those files are JSP, I can use JSP EL and use something like and handle it on the server side.


Anyway, I wonder how this is done without JSP. I like to use javascript and grunt tasks only. I sow another solution which talks about injecting the tag with javascript. Are there other solutions?


Thanks





Aucun commentaire:

Enregistrer un commentaire