1.0.0 • Published 9 months ago

ssi-replace-webpack-plugin v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

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-dev

Usage

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

OptionTypeRequiredDefaultDescription
headerUrlstringYes-URL to fetch header HTML content
footerUrlstringYes-URL to fetch footer HTML content
sidebarUrlstringYes-URL to fetch sidebar HTML content
ssiTagsstring[]NoSee belowCustom 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.html in your build output
  • Uses axios for content fetching

License

MIT License

1.0.0

9 months ago