rollup-plugin-htmlvue

Rollup plugin for transforming HTML/XML to Vue SFC
988 3
Install
npm install rollup-plugin-htmlvue
Latest Version:1.2.2
Older releases:2
License:MIT
Last Updated:Oct 11, 2025
Links: GitHub  ·  npm
Maintainer: hirokiosame

rollup-plugin-htmlvue

Import HTML-snippets and SVGs as Vue components.

Features

  • 🔥 Works with Vue 2 & 3 Comiles the HTML to a Vue.js SFC for the Vue plugin to handle compilation
  • 💫 Versatile Supports any XML-parseable markup

🙋 Why?

Great for compiling SVG files as Vue.js components.

🚀 Install

npm i -D rollup-plugin-vue rollup-plugin-htmlvue

🛠 Config

rollup.config.js

import vue from 'rollup-plugin-vue'
import htmlvue from 'rollup-plugin-htmlvue'

export default {
    // ...

    plugins: [
        vue(),
        htmlvue()
    ]
}

By default, it only automatically resolves .html files. To apply it to other extensions:

htmlvue({
    include: '**/*.svg'
})

⚙️ Options

vPre

Type: boolean

Default: false

Adds v-pre to the root element.

vOnce

Type: boolean

Default: false

Adds v-once to the root element.

functional

Type: boolean

Adds functional to the template to make it a functional component. Only supported in Vue 2.

inheritListeners

Type: boolean

Adds v-on="$listeners" to the root element to inherit event listeners. Only supported in Vue 2.

include/exclude

Patterns to identify which files to apply the plugin to. Passed into @rollup/pluginutils.

Related Packages

rollup-plugin-vue-inline-svg

convert svg files to optimised vue components

21,881
rollup-plugin-svg-sprites

Rollup plugin for creating SVG sprites.

16,919
lax-markup

Lax HTML, XML, SVG, and component (Vue, Svelte, Astro) formatter that never rein...

1,031 14
stylelint-config-html

The shareable HTML config for Stylelint.

26,955,176 90
vue-sfc-loader

vue sfc loader for browser

9,765

Version History

Version Released Vue License
1.2.2 MIT
1.2.1 MIT
1.2.0 ^2.6.11 MIT
1.1.0 ^2.6.11 MIT
1.0.0 ^2.6.11 MIT