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
A subset of Vue optimized for progressive enhancement.
3
+
`petite-vue` is a subset of Vue optimized for progressive enhancement. It provides the same template syntax and reactivity mental model with standard Vue. However, it is specifically optimized for "sprinkling" small amount of interactions on an existing HTML page rendered by a server framework.
4
4
5
-
- 5.5kb w/ most non-component features
5
+
- 5.5kb min+brotli w/ most non-component features
6
6
- DOM-based, mutates in place
7
7
- Driven by `@vue/reactivity`
8
8
9
9
## Usage
10
10
11
+
`petite-vue` has one special directive: `v-scope` that is not present in standard Vue. Use it to mark regions on the page that should be controlled by `petite-vue`:
The `defer` attribute makes the script execute after HTML content is parsed, and `init` tells `petite-vue` to automatically query and initialize all elements that have `v-scope` on the page.
25
24
26
-
There are no components, but logic can be shared across the app or encapsulated in setup-like functions:
25
+
### Manual Init
26
+
27
+
If you don't want the auto init, remove the `init` attribute and move the scripts to end of `<body>`:
- Reactivity for Collection Types (Map, Set, etc.)
72
-
- Components
166
+
Some features are dropped because they have a relatively low size/utility ratio in the context of progressive enhancement. If you need these features, you should probably just use standard Vue.
167
+
168
+
-`ref()`, `computed()` etc.
169
+
- Components (see "Reuse Logic" section above)
170
+
- Template refs (just use selectors)
171
+
- Render functions (`petite-vue` has no virtual DOM)
172
+
- Reactivity for Collection Types (Map, Set, etc., removed for smaller size)
0 commit comments