Skip to content

PostHTML

@vituum/vite-plugin-posthtml

twig
<extends src="layout.html">
    <block name="body">
        <include src="main.html"></include>
    </block>
</extends>
<extends src="layout.html">
    <block name="body">
        <include src="main.html"></include>
    </block>
</extends>

See docs for more info about the syntax

Install

npm

bash
npm i @vituum/vite-plugin-posthtml --save-dev
npm i @vituum/vite-plugin-posthtml --save-dev

yarn

bash
yarn add @vituum/vite-plugin-posthtml -D
yarn add @vituum/vite-plugin-posthtml -D

Config

javascript
import posthtml from '@vituum/vite-plugin-posthtml'

export default {
    plugins: [posthtml()]
}
import posthtml from '@vituum/vite-plugin-posthtml'

export default {
    plugins: [posthtml()]
}

Options

root

  • Type: string
  • Default: null

Root path to use for built-in extend and include plugins. Current path of .html is used if not defined.

extend

  • Type: Object | false
  • Default: {}

PostHTML posthtml-extend plugin options. Can be disabled from loading with false.

include

  • Type: Object | false
  • Default: {}

PostHTML posthtml-include plugin options. Can be disabled from loading with false.

plugins

  • Type: (Plugin | Plugin[] | Promise<Plugin | Plugin[]>)[]
  • Default: []

Additional PostHTML plugins to use. See PostHTML GitHub for list of all official plugins.

options

  • Type: Object
  • Default: {}

Additional PostHTML options to use. See PostHTML options for more info.

Released under the MIT License.