This module makes the Vue.js and petite-vue JavaScript libraries available to Drupal, allowing other modules to use them. It can be configured to load Vue.js from a CDN or a local installation.
This module provides the Vue.js library as a Drupal library. It is compatible with both Vue 2 and 3 and comes with additional support for petite-vue.
This module does nothing on its own. There is no need to install this module unless another module requires its generated library definitions.
Vue library loading
Via CDN
- Navigate to the
admin/config/development/vuejspage. - Set the installation type to "Use an external CDN".
- Select your preferred provider and Version.
Via local library installation using Composer Merge Plugin (Vue 3 only)
- Install the composer merge-plugin via
composer require wikimedia/composer-merge-plugin - Add the following entry in your composer.json:
"merge-plugin": { "include": [ "web/modules/contrib/vuejs/composer.libraries.json" ] }, - Update the vuejs module via composer:
composer update 'drupal/vuejs' - Navigate to the
admin/config/development/vuepage. - Set the installation type to "Local library".
- Set the library path to
/package/dist/vue.runtime.global.prod.jsif not already defined so.
Via local library installation using manual download
Vue 3
- Download
https://registry.npmjs.org/vue/-/vue-3.5.13.tgz - Extract the tar inside the drupal
libraries/vuefolder. - Navigate to the
admin/config/development/vuejspage. - Set the installation type to "Local library".
- Set the library path to
/libraries/vue/package/dist/vue.runtime.global.prod.jsif not already defined so.
Vue 2
- Download
https://registry.npmjs.org/vue/-/vue-2.7.16.tgz - Extract the tar inside the Drupal
libraries/vuefolder. - Navigate to the
admin/config/development/vuejspage. - Set the installation type to "Local library".
- Set the library path to
/libraries/vue/package/dist/vue.min.jsif not already defined so.
USAGE
- You can use it inside Twig templates as usual, for example:
{{ attach_library('vuejs/vue') }} - You can attach it programmatically:
function MYMODULE_page_attachments(array &$attachments) { $attachments['#attached']['library'][] = 'vuejs/vue'; } - You can add it as a dependency inside your
*.libraries.yml:
dependencies: - vuejs/vue
Petite vue
Library installation via manual download
- Download
https://registry.npmjs.org/petite-vue/-/petite-vue-0.4.1.tgz - Extract the tar inside the drupal
libraries/petitevuefolder. - Navigate to the
admin/config/development/vuejspage. - Set the installation type to "Local library".
- Set the library path to
/libraries/petitevue/package/dist/petite-vue.iife.jsif not already defined so.
Library Installation via CDN
- Navigate to the
admin/config/development/vuejspage. - Set the installation type to "Use an external CDN".
- Select your preferred provider and Version.
USAGE
- You can use it inside Twig templates as usual, for example:
{{ attach_library('vuejs/petitevue') }} - You can attach it programmatically:
function MYMODULE_page_attachments(array &$attachments) { $attachments['#attached']['library'][] = 'vuejs/petitevue'; } - You can add it as a dependency inside your
*.libraries.yml:
dependencies: - vuejs/petitevue
Ask your assistant about Vue.js Library
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Release Timeline
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 3.2.2 | Stable | 10–11 | Nov 28, 2024 | ||
| 3.2.1 | Stable | 10–11 | Nov 21, 2024 | ||
| 3.2.0 | Stable | 10–11 | Nov 21, 2024 | ||
| 3.1.0 | Stable | 10–11 | Nov 4, 2024 | ||
| 3.0.3 | Stable | 9–10 | PHP 7.4 | Jan 31, 2024 | |
| 3.0.2 | Stable | 9–10 | PHP 7.4 | Jan 29, 2024 | |
| 3.0.1 | Stable | 9–10 | PHP 7.4 | Jan 29, 2024 | |
| 3.0.0 | Stable | 9–10 | PHP 7.4 | Nov 9, 2023 | |
| 3.0.0-alpha1 | Pre-release | 9–10 | PHP 7.4 | May 17, 2023 | |
| 3.x-dev | Dev | 10–11 | PHP 8 | Apr 5, 2023 |