Our-Umbraco-TagHelpers
Our-Umbraco-TagHelpers copied to clipboard
our-svg caches the CSS class
For the same SVG I have both
<our-svg src="@Model.SiteLogo" class="foo"></our-svg>
<our-svg src="@Model.SiteLogo" class="bar"></our-svg>
With the cache turned on the class attribute is cached and 'foo' is rendered in both locations. I suggest adding the CssClass to the cache key is the simplest workaround. The ideal solution would presumably be to cache the file content rather than the HTML output.
@drpeck do you fancy trying to solve this problem and submit a PR and update the unit tests for this scenario ?
Is the preferred approach to add the class to the cache key? That will resolve this issue, but I suspect that the issue may exist for all attributes (e.g. <our-svg src="@Model.SiteLogo" id="logo"></our-svg>
). Ideally the file contents would be cached and the rendering of the tag would not be, but that looks like a much bigger change.
Happy to any solutions or ideas you have for this @drpeck