Vue.js logo

The module provides a bridge between Drupal and Vue.js framework.

This module does nothing on its own. There is no need to install this module unless another module requires it.

Vue 3 / Petite-Vue Support (3.x)

The 3.x branch is where we'll be supporting Vue 3. We'll also be adding a library definition to include Petite-Vue.

TODO: Add README documentation and link

The library names are
vuejs/vue
vuejs/petitevue

Vue2 Docs (8.x-1.x)

Usage:

1. You can use inside twig templates as usual, example:

{{ attach_library('vuejs/vue') }}

2. You can attach it programmatically:

function MYMODULE_page_attachments(array &$attachments) {
  $attachments['#attached']['library'][] = 'vuejs/vue';
}

3. You can add it as dependency inside your *.libraries.yml:

  dependencies:
    - vuejs/vue
    - vuejs/vue_router
    - vuejs/vue_resource

4. Loading libraries:
a) Use the following Drush commands if you want to install the libraries locally:

drush vuejs:download vue
drush vuejs:download vue-router
drush vuejs:download vue-resource

Latest (.dev) version also adds the possibility to use composer based requirement:
b) npm-asset:

composer require npm-asset/vue:^2
composer require npm-asset/vue-router
composer require npm-asset/vue-resource

c) bower-asset:

composer require bower-asset/vue:^2
composer require bower-asset/vue-router
composer require bower-asset/vue-resource

(See https://www.drupal.org/docs/develop/using-composer/using-composer-to-ins... for details on using Asset Packagist)

d) The module also proved the option to load the libraries from CDNs.

Supporting organizations: 
proudly helps to maintain this module for the community
Development and maintenance of the 3.x branch.

Project information

Releases