Petite-Vue: Minimal Vue Subset for Progressive Enhancement

0.4.1 · maintenance · verified Sun Apr 19

petite-vue is a lightweight (approx. 6kb) distribution of Vue.js designed specifically for progressively enhancing existing HTML pages with reactivity, rather than building single-page applications. It provides the core Vue template syntax and reactivity model but is optimized for "sprinkling" interactions without a build step. The current version is `0.4.1`, and its development status, as per the README, indicates that while usable, it is still relatively new with potential for API changes. The project maintains a very focused, minimal scope, with issue tracking and feature requests explicitly disabled to prioritize core functionality. Its key differentiators include its minuscule size, server-side rendering friendliness, direct DOM manipulation, and the ability to integrate interactivity into static pages using a familiar Vue-like syntax, often without requiring a full build pipeline.

Common errors

Warnings

Install

Imports

Quickstart

This HTML snippet demonstrates how to use petite-vue directly in the browser with CDN. It shows automatic initialization, basic reactivity with `v-scope` for data binding, click handlers, and list rendering using `v-for`.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Petite-Vue Counter</title>
  <script src="https://unpkg.com/petite-vue" defer init></script>
</head>
<body>
  <h1>Petite-Vue Example</h1>

  <div v-scope="{ count: 0, message: 'Hello Petite-Vue!' }">
    <p>Count: {{ count }}</p>
    <p>Message: {{ message }}</p>
    <button @click="count++">Increment Count</button>
    <button @click="message = 'Updated!'">Change Message</button>
  </div>

  <div v-scope="{ items: ['apple', 'banana', 'cherry'] }">
    <h2>Grocery List</h2>
    <ul>
      <li v-for="item in items">{{ item }}</li>
    </ul>
    <button @click="items.push('date')">Add Item</button>
  </div>
</body>
</html>

view raw JSON →