ssi-replace-webpack-plugin
v1.0.0
Published
A Webpack plugin that replaces SSI tags with HTML content from specified URLs, designed for development server use.
Maintainers
Readme
SsiReplaceWebpackPlugin
A Webpack plugin that fetches HTML content for SSI tags and replaces them in index.html, for development use only.
Installation
npm install ssi-replace-webpack-plugin --save-devUsage
import SsiReplaceWebpackPlugin from "ssi-replace-webpack-plugin";
export default {
mode: "development",
plugins: [
new SsiReplaceWebpackPlugin({
headerUrl: "http://localhost:3000/header.html",
footerUrl: "http://localhost:3000/footer.html",
sidebarUrl: "http://localhost:3000/sidebar.html",
// Optional: custom SSI tags
ssiTags: [
"<!--#include virtual='header.html' -->",
"<!--#include virtual='footer.html' -->",
"<!--#include virtual='sidebar.html' -->",
],
}),
],
};Options
| Option | Type | Required | Default | Description |
| ------------ | -------- | -------- | --------- | --------------------------------- |
| headerUrl | string | Yes | - | URL to fetch header HTML content |
| footerUrl | string | Yes | - | URL to fetch footer HTML content |
| sidebarUrl | string | Yes | - | URL to fetch sidebar HTML content |
| ssiTags | string[] | No | See below | Custom SSI tags to replace |
Default SSI tags if not specified:
<!--#include virtual='header.html' -->
<!--#include virtual='footer.html' -->
<!--#include virtual='sidebar.html' -->Notes
- Only works in development mode
- Requires
index.htmlin your build output - Uses axios for content fetching
License
MIT License
