Closed cvocvo closed 10 months ago
Not at the moment but I'm open to suggestions. What alternative way would you have liked to consume the built version?
Thanks for the quick response; ideally just a regular old .js
file would be great. Then this can be included in the Smidge bundle, however, it also opens the door to other users who are just building websites with regular <script src="/js/somejslib.js"></script>
files. I'm thinking of stuff like Bootstrap where you can just pull in JS and CSS manually without the complexity of NPM and pipeline tools like ESBuild/Babel/NX. I don't know the right way to describe these JS libraries/frameworks where they're just stand-alone JS files that get included. IIFE comes to mind but I don't know if that's precisely it.
Would you expect this file to expose "isbot" as a global variable then (see following example)?
<script src="https://cdn.js/isbot.js"></script>
<script>
console.log(isbot(navigator.userAgent))
</script>
Yes that would be great
Okay, I've inspected JSDeliver as a CDN.
You can import and use the module on your web page already using the "mjs" version.
<script type="module">
import isbot from "https://cdn.jsdelivr.net/npm/isbot/index.mjs";
console.log(isbot(navigator.userAgent));
</script>
Other than that - I can create an iife version to be imported via JSDeliver CDN as well.
That's fantastic -- I will test this out! I think the IIFE version will let me drop it into Smidge. I haven't figured out how to bundle all my JS together and then import the module (because the JS is all getting loaded before via <script src=
).
Update: Works great; thank you for adding support for this!
You can now use the iife script straight from this CDN or download it to your machines
<script src="https://cdn.jsdelivr.net/npm/isbot/index.iife.min.js"></script>
Steps to reproduce
We're using Umbraco (ASP.NET Core) with Smidge to deliver javascript bundles to client devices. Is there a version of isbot that doesn't require NPM?
Thank you!