Skip to content
the poor coder

vue.js cdn script

Poor Man
Published
Reading time
2 min read
On this page

Vue.js CDN Script#

If you're looking to include Vue.js in your project without having to download and install it, you can use the Vue.js CDN (Content Delivery Network) script.

Option 1: Using Vue.js CDN with script tags#

You can include Vue.js in your HTML file by adding the following script tag to the head section of your HTML file:

Text
<head>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

This script tag will load the latest version of Vue.js from the CDN and make it available for use in your application.

Option 2: Using Vue.js CDN with module script tags#

If you're using ES modules in your application, you can also load Vue.js from the CDN using the following script tag:

Text
<head>
  <script type="module" src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>

This script tag will load the latest version of Vue.js as an ES module and make it available for use in your application.

Option 3: Using Vue.js CDN with a specific version#

If you need to use a specific version of Vue.js, you can specify the version number in the script tag. For example, to use version 2.6.11 of Vue.js, you can use the following script tag:

Text
<head>
  <script src="https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.js"></script>
</head>

This script tag will load version 2.6.11 of Vue.js from the CDN and make it available for use in your application.

Option 4: Using Vue.js CDN with minified script#

If you want to reduce the file size of your application, you can use the minified version of Vue.js. To do this, you can use the following script tag:

Text
<head>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
</head>

This script tag will load the minified version of Vue.js from the CDN and make it available for use in your application.

Option 5: Using Vue.js CDN with a local fallback#

It's always a good idea to have a fallback in case the CDN is unavailable. To do this, you can include a local copy of Vue.js in your project and use it if the CDN is down. For example:

Text
<head>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js" integrity="sha384-XXXXXXX" crossorigin="anonymous"></script>
  <script>
    if (typeof Vue === 'undefined') {
      document.write('<script src="/path/to/vue.js"></script>')
    }
  </script>
</head>

This script tag will load Vue.js from the CDN, but if it's unavailable, it will load a local copy of Vue.js instead.

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC