You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
___Tl;dr.___`Vueify.js` is an attempt to recreate the desired behavior of [Vueify](https://github.com/vuejs/vueify) in browser environment!
8
+
___Tl;dr.___`Vueify.js` is an attempt to recreate the desired behavior of [Vueify](https://github.com/vuejs/vueify) in browser environment hence suffix with .js to indicate it is a frontend library.
9
9
10
10
> Vue's [Single-File-Compoment(SFC)](https://vuejs.org/v2/guide/single-file-components.html) is a nice feature allowing modular code and easier code refactorization. However, a SFC **(*.vue)** file needs to be locally compiled into into browser recognizable primitives(js, css, etc.) before shipping to your browser. This process is not at all straight-forward. At the minimium you will need:
11
11
>
@@ -17,21 +17,41 @@ ___Tl;dr.___ `Vueify.js` is an attempt to recreate the desired behavior of [Vuei
17
17
18
18
19
19
## Usage:
20
-
**First include script tags linked to .vue files, then include vueify.js**
21
20
22
-
Set `type='vue'` for our script tags, because browser won't automatically load content in script tags with unknown type.
23
-
21
+
**Include vueify.js to your html, then initialize the plugin with `Vue.use()`.**
22
+
24
23
```html
25
-
<scriptsrc="Hello.vue"type='vue'></script>
26
24
<scriptsrc="vueify.js"></script>
27
25
```
28
26
29
-
SFC loaded this way will be registered globally under the its file name (e.g., Hello.vue ==> hello) or the name user specified in script tag.
30
-
31
-
```html
27
+
```js
28
+
Vue.use(Vueify);
29
+
var app =newVue({ ... });
30
+
```
31
+
32
+
**Static Loading .vue file via \<script\> and register it as a global component**
33
+
34
+
*Set `type='vue'` for our script tags, because browser won't automatically load content in script tags with unknown type.*
35
+
36
+
```html
37
+
<scriptsrc="Hello.vue"type='vue'></script> // component name with be default to 'hello'
`vueify.js` will first scan document for script tags with `type=vue`, gather url for .vue files.
@@ -41,7 +61,7 @@ It then downloads and transpiles these .vue files and their dependent .vue files
41
61
We refer to .vue files inside script tags as root-level therefore they will be automatically loaded as global Vue components by `vueify.js`. Users are responsible for registering any children Vue component inside these .vue files.
42
62
43
63
44
-
## Example:
64
+
## Minimum Example:
45
65
Write your Vue component like this:
46
66
```html
47
67
// Hello.vue
@@ -89,7 +109,6 @@ Then write your html like this:
89
109
90
110
91
111
## Note:
92
-
* Please verify that `vueify.js` loads after `vue.js` and `*.vue`.
93
112
* No custom lang support ~~lang="coffee"~~ in .vue.
94
113
* Use ES6's `import/export` for nested components, CommonJS's `require/module.exports` is not currently supported.
95
114
* Cyclic dependency in .vue file will cause transpile error.
0 commit comments