e2openplugin-OpenWebif
e2openplugin-OpenWebif copied to clipboard
Include JS and CSS min with version
Change all imports like this:
OLD:
<script type="text/javascript" src="js/openwebif-1.2.20.min.js"></script>
NEW:
<script type="text/javascript" src="js/openwebif.min.js?v1.2.20"></script>
To force browser cache reload on changed.
+1 - I don't think it breaks anything.
It makes the development much easier too.
I would prefer to see optimised http etag and cache headers as it shouldn't be necessary to modify .tmpl
each time a js file is versioned. Alternatively, there are build tools which can replace paths in html with version/checksum numbers.
(I know Firefox has historically had a very aggressive caching strategy.)
I use Chrome and i always need to reload the js files separately. We can use the hash of the file and modify the tmpl files automatically by build-js but only if changed.
With an etag the browser still has to query the server (using HEAD) if the status of the file in cache is still valid. You have to die one dead here (as we say here).
We can use something like this.
https://github.com/techjacker/node-version-assets
I have checked node-version-assets. It works but it's BAD because we get always a new name for the css and js. This needs a huge cleanup on the box.
Classic JS -> DONE
May I suggest using an $assetCacheBuster variable in .tmpl files with a singular value set in the base controller or main.tmpl?
#set $assetCacheBuster = '1.3.2'
...
<script>openwebif.js?v=$assetCacheBuster</script>
Yes, we can do this. But normally we do have that much changes. And we have different versions of the js files. I think autogenerated md5 hash of the file will be better.
Something like the node-version-assets. But without renaming the file itself.
#1392 starts the journey towards automated versioning for modern
(utilising webpack for js build).
There's more work to be done such as modifying the CI build to generate modern assets before tmpl -> py build compilation.
You do not need to think about this. The templates will be compiled again after /CI/build.sh
Will be fixed in 2.0