unplugin-posthtml
v0.1.5
Published
Unplugin for posthtml
Maintainers
Readme
unplugin-posthtml
Unplugin integration for PostHTML across multiple bundlers.
Description
unplugin-posthtml is a versatile plugin that seamlessly integrates PostHTML with various JavaScript bundlers, including Vite, Webpack, Rollup, Esbuild, Farm, Rolldown, and Rspack. Enhance your HTML processing workflow by leveraging the power of PostHTML plugins within your preferred bundler environment.
Features
- Multi-Bundler Support: Compatible with Vite, Webpack, Rollup, Esbuild, Farm, Rolldown, and Rspack.
- Flexible Configuration: Easily customize PostHTML plugins to fit your project's needs.
- TypeScript Ready: Built with TypeScript for type safety and better developer experience.
- Extensible: Add and configure your own PostHTML plugins effortlessly.
Installation
Use your preferred package manager to install unplugin-posthtml along with its peer dependencies.
Using npm
npm install unplugin-posthtmlUsing pnpm
pnpm install unplugin-posthtmlUsing yarn
yarn add unplugin-posthtmlUsing bun
bun add unplugin-posthtmlUsage
// vite.config.ts
import posthtml from "unplugin-posthtml/vite";
import { defineConfig } from "vite";
export default defineConfig({
// ...other configurations
plugins: [
posthtml()
]
});// webpack.config.js
module.exports = {
// ...other configurations
plugins: [
require('unplugin-posthtml/webpack')({
// posthtml config
})
]
}// rollup.config.js
import posthtml from "unplugin-posthtml/rollup";
export default {
// ...other configurations
plugins: [
posthtml()
]
};// esbuild.config.ts
import { build } from "esbuild";
import posthtml from "unplugin-posthtml/esbuild";
build({
// ...other configurations
plugins: [
posthtml()
]
});// farm.config.ts
import { defineConfig } from "@farmfe/core";
import posthtml from "unplugin-posthtml/farm";
export default defineConfig({
// ...other configurations
plugins: [
posthtml()
]
});// rolldown.config.ts
import posthtml from "unplugin-posthtml/rolldown";
export default {
// ...other configurations
plugins: [
posthtml()
]
};// rspack.config.ts
module.exports = {
// ...other configurations
plugins: [
require('unplugin-posthtml/rspack')({
// posthtml config
})
]
}// vue.config.js
module.exports = {
// ...other configurations
configureWebpack: {
plugins: [
require('unplugin-posthtml/webpack')({
// posthtml config
})
]
}
}// nuxt.config.ts
export default defineNuxtConfig({
// ...other configurations
modules: [
['unplugin-posthtml/nuxt', ]
]
})// astro.config.mjs
import { defineConfig } from 'astro/config'
import posthtml from 'unplugin-posthtml/astro'
// https://astro.build/config
export default defineConfig({
// ...other configurations
integrations: [
posthtml()
]
})postHTML config
// posthtml.config.js
module.exports = () => ({
plugins: {
// plugins config
'posthtml-include': { root: 'src' } // example plugin
}
});