Including Vue.js in your project can be as simple as adding a vue.js cdn link to your HTML file. CDNs (Content Delivery Networks) are the backbone of the internet, catering to the fast distribution of libraries and resources. In this post, we’ll provide a list of CDNs that host Vue.js libraries and the code snippets to include them directly in your HTML.
Table of Contents
JsDelivr CDN
JsDelivr is a popular CDN that serves many open-source projects, including Vue.js. Here is how you can include Vue.js via JsDelivr:
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.min.js" integrity="sha384-+XfDzUl5qc+v58X9t+s0OQw+I1zRHYJzQ8LcOTy0PI6lL5XQoxf2jZlV/I6FJRzr" crossorigin="anonymous"></script>
cdnjs CDN
Another reliable CDN is cdnjs. Here’s the vue.js cdn link from cdnjs:
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.14/vue.min.js" integrity="sha512-OlUw6QvJTGcK7vPSmlvmCbsHUfrYKHK+j/XdylZ0pT0ykez8ZY+tDGIMCtGJrA8I1H2JGoa2KciwqE1vu5P/eA==" crossorigin="anonymous"></script>
unpkg CDN
The unpkg CDN allows you to serve any file from npm. Here’s how to use it for Vue.js:
<script src="https://unpkg.com/[email protected]/dist/vue.min.js"></script>
Skypack CDN
Skypack is a new CDN that provides native browser support for JavaScript modules (ESM). You can load Vue.js as follows:
<script type="module" src="https://cdn.skypack.dev/vue"></script>
Summary
CDNs are an excellent way to include Vue.js in your project without the need to download and host the libraries yourself. We’ve listed several CDN options such as JsDelivr, cdnjs, unpkg, and Skypack. Remember to replace the version numbers in the code snippets with the version you require for your project.
References
