https://github.com/b13/grunt-requirejs-vue-component-registration
https://github.com/b13/grunt-requirejs-vue-component-registration
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/b13/grunt-requirejs-vue-component-registration
- Owner: b13
- License: mit
- Created: 2018-04-19T12:03:13.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-09-05T13:00:51.000Z (almost 6 years ago)
- Last Synced: 2025-07-18T07:43:17.718Z (12 months ago)
- Language: JavaScript
- Size: 58.6 KB
- Stars: 0
- Watchers: 6
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# 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](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
```shell
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:
```js
grunt.loadNpmTasks('grunt-requirejs-vue-component-registration');
```
## The "requirejsVueComponentRegistration" task
### Overview
Create vue component config for async loading with requirejs.
```js
grunt.initConfig({
requirejsVueComponentRegistration: {
options: {
files: ['pathToVueFiles/**/*.vue'],
basePath: 'basePathToVueFiles',
targetFile: 'basePathToVueFiles/registerComponents.js'
}
}
});
```
targetFile output:
```js
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