Search code examples
dartangular-dart

AngularDart build version in files in HTML preventing caching new build


I am trying to achieve build solution, where I would get (after webdev build) files with cache-resistant urls of files, e.g. in index.html there would be instead of <script defer src="main.dart.js"></script> something like <script defer src="main.dart.js?v=1.1.0"></script> – I don't really care if that is the version of the package version or some random hash.

My point of this is that if I do build a new version, I need users to get this newest version, not a cached one from before (because of the same url).


Solution

  • I have a little builder that I use for this on my projects, I just published it on pub as built_html, see here https://pub.dartlang.org/packages/built_html.

    Let me know if it works for you and file bug reports if you find anything or want new features!