Vue bootstrap for Elgg

1.0.0 2019-09-30 16:31 UTC

This package is auto-updated.

Last update: 2019-11-30 16:55:21 UTC


Provides a generic bootstrap for using Vue components inside Elgg.


Inside your plugin create:


    "private": true,
    "scripts": {
        "build": "npm run production && rm ./views/default/mix-manifest.json && php ../../elgg-cli flush",
        "production": "npm run components:parse && cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "components:parse": "node node_modules/@hypejunction/vue-scanner/cli/scan.js"
    "dependencies": {
        "cross-env": "^5.2.0",
        "global": "^4.4.0",
        "laravel-mix": "^4.1.2",
        "lodash.camelcase": "^4.3.0",
        "vue": "^2.6.10",
        "vue-template-compiler": "^2.6.10"
    "devDependencies": {
        "@babel/plugin-syntax-dynamic-import": "^7.2.0",
        "@hypejunction/vue-scanner": "^1.1.3"
    "vue-scanner": {
        "src": {
            "components": {
                "dirs": [
                "async": false
        "target": {
            "js": "./src/PLUGIN_NAME/components.js",
            "json": "./src/PLUGIN_NAME/components.json"
        "chunks": true,
        "requestChunks": true,
        "chunkPrefix": "PLUGIN_NAME/"


let mix = require('laravel-mix');

	.js('src/PLUGIN_NAME/init.js', 'views/default/PLUGIN_NAME/init.js');

	externals: {
		elgg: 'elgg',
		vue: 'vue',

	optimization: {
		splitChunks: false,

	output: {
		libraryTarget: 'umd',
		publicPath: `/mod/PLUGIN_NAME/views/default/`,


Inside your init.js you can use ES6 to import Vue, register your components, setup your Vue extensions etc.

import Vue from 'vue';

// Vue.component();

import './components';

The above setup makes it easier to work with components, using vue-scanner, which will automatically register all the components for you. You will just need to import the components.js in your init.js.

Then run yarn build - this will build your components into views/default, so you can use them inside your templates.

You can then add these components into your plugin's views:

echo \hypeJunction\VueBoot\Vue::instance()->render('MyComponent', [
	'params' => $entity->getParams(),
	// list all props to pass to the component
], [
	'PLUGIN_NAME/init', // load the init script