0.1.2 • Published 6 years ago

grunt-requirejs-vue-component-registration v0.1.2

Weekly downloads
1
License
-
Repository
github
Last release
6 years ago

grunt-requirejs-vue-component-registration

Create vue component config for async loading with requirejs

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-requirejs-vue-component-registration --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-requirejs-vue-component-registration');

The "requirejsVueComponentRegistration" task

Overview

Create vue component config for async loading with requirejs.

grunt.initConfig({
    requirejsVueComponentRegistration: {
        options: {
            files: ['pathToVueFiles/**/*.vue'],
            basePath: 'basePathToVueFiles',
            targetFile: 'basePathToVueFiles/registerComponents.js'
        }
    }
});

targetFile output:

define([
    "Vue"
], function(Vue) {

    /**
     * register vue components for async loading
     */

    return (function() {

        function registerComponents() {

            Vue.component('nice-component', function (resolve, reject) {
                require(["vue!/Components/niceComponent"], function(component) {
                    resolve(component);
                });
            });

        }

        return registerComponents();
	});
});

Release History

  • Big bang
0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago