require-vuejs
RequireJS plugin to async and dynamic load and parse .vue single file components
This library has only 4Kb ( minified ).
What this library can do
- Real time integration
- Don't need build to use
- Used as RequireJS plugin
- You can use syntax detection from your IDE
- Suport for single file component
- Work with or without extension
- Support .html and .vue files
- CSS inside component file
What this library can't do
- Parse Jade and other templates
- Scoped css
CDN
Development ( last version )
https://rawgit.com/edgardleal/require-vuejs/master/dist/require-vuejs.js
For production usage: ( Fast CDN, long age cache and minified )
https://cdn.rawgit.com/edgardleal/require-vuejs/aeaff6db/dist/require-vuejs.min.js
NPM repository
Installation fromnpm install require-vuejs
Usage
This example on Codepen
File structure
app.js
component.vue
index.html
Source code example
index.html
Require Vue
Create your component: ( component.vue )
{{text}}
Create your app code: ( app.js )
requirejs; // to use component in your code with RequireJS: // put a reference to your component file with or without extencion after 'vue!' ;
Optimize ( r.js )
Create a build file to r.js
. In this example we are using a file named build.js
:
baseUrl: "." paths: "Vue": "https://cdnjs.cloudflare.com/ajax/libs/vue/2.2.1/vue" "vue": "require-vuejs" // full path to require-vuejs library file name: "app" out: "main-built.js"
After create the file build.js
with your build configuration execute this command:
r.js -o build.js