Our.Umbraco.TagHelpers 1.2.0 released https://www....
# news
w
Adds @skttl our-fallback from 24days in article https://24days.in/umbraco-cms/2022/static-assets-taghelper/
1.1.0 Also released this week with some community fixes and @Matt Wise added a fallback feature to the use of our-link
h
I thought .net could handle the CDN thing itself using asp-fallback-src= or is this different in that it pulls the file from CDN?
s
asp-fallback-src is for going third party first, eg. if the connection to the CDN fails, then it will load from your fallback. our-self-host downloads the file from the CDN, and serves it from your own server. You can read more about it here: https://24days.in/umbraco-cms/2022/static-assets-taghelper/ and on https://csswizardry.com/2019/05/self-host-your-static-assets/ you can read about why you should self host instead of using third parties for this.
h
Thanks skttl 😄 not sure if I'm doing something wrong, but it doesn't seem to work for me 😢 It downloads the js files quite happily, but the browser doesn't load them. this is example script tag
<script src="https://code.jquery.com/jquery-3.6.0.min.js" crossorigin="anonymous" our-self-host></script>
But on load I get the errors in the image
s
Definitely looks like a bug 🙂
I assume you have the file in /wwwroot/assets, right?
h
yes, it is trying to load
https://localhost:44316/~/assets/jquery-3.6.0.min.js
which fails because of the /~
s
Probably shoudln't have the tilde then, I can see in our own implementation we don't either 🙂 Try setting the rootfolder (in appsettings at Our.Umbraco.TagHelpers:OurSelfHost:RootFolder) to eg. /assets (without the tilde)
h
That sorted it thanks 👍
Would be good to have one for css too 😄
s
It works for css too, anything using a src or href attribute 🙂