I'm trying to add a version querystring to some CSS and JS files via an Outbound rewrite rule as follows:
<outboundRules>
<rule name="AppendQueryStringToAssets" preCondition="IsHtmlFile">
<match filterByTags="Link, Script" pattern="^(.*app.*s)" />
<action type="Rewrite" value="{R:1}?v=1.0.0" />
</rule>
<preConditions>
<preCondition name="IsHtmlFile">
<add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" />
</preCondition>
</preConditions>
</outboundRules>
Then in my HTML I have the following elements:
<link media="all" rel="stylesheet" href="../../css/app.css">
<script type="module" src="../../js/app.js"></script>
<script nomodule src="../../js/app.es5.js"></script>
Per the spec nomodule
is a boolean attribute, so doesn't need a value specified.
However, when viewing the served html, I get the following (last src doesn't have a query string appended):
<link media="all" rel="stylesheet" href="../../css/app.css?v=1.0.0">
<script type="module" src="../../js/app.js?v=1.0.0"></script>
<script nomodule src="../../js/app.es5.js"></script>
If I move the nomodule
attribute after the src
attribute it works, similarly if I give nomodule
a value it works, but neither of those seem like they should be needed:
<script src="../../js/app.es5.js?v=1.0.0" nomodule></script>
Is there a way to support this via the config to ensure it doesn't matter how the script element is written?
I tried creating a custom tag script nomodule
but that didn't seem to make any difference either.