We are developing a Main WebApp with angularJS as a Single Page application for a Cordova mobile App.
We have moved part of the static resources into a couple of bundles that will be served from a different CDN WebApp from another domain.
We are not using the @Scripts.Render
@Styles.Render
razor helper because bundles are directly referenced from the embedded static index.html inside the mobile app like this (Appended via AngularJS):
<script src="https://service.foo.it/CDN/cdnFooJs"></script>
<script src="https://service.foo.it/CDN/cdnFooCss"></script>
As we are not using razor, we are not appending any cache token to the src and that's not what we want;
we need a version token to force the client to download the updated version of the bundle.
I've read in some previous post that the v
token is calculated every time Scripts.Render is used.
Now, the question is:
is it possible, to access the value of this token programmatically ?
We would like to create a service controller that, given a bundles route, returns the SHA256 token of the bundle.
Once received,it will be used to build the script tags that will be appended dinamically to the DOM.
<script src="https://service.foo.it/CDN/cdnFooJs?vtoken=asd3...."></script>
<script src="https://service.foo.it/CDN/cdnFooCss?vtoken=dasdasrq..."></script>
Note:
We already know that we can create our token by ourselves (for example using the build number), but it would nice to have something with less effort and more tied to the bundle mechanism.