HTML Merge
This package provides a command-line tool for minimal static sites, using HTML Merge.
Updates are done in-place - there is no second output directory.
The specification aims to be so simple that you could implement this easily yourself, if you have access to an HTML parser and basic CSS selectors.
Usage
If you have a directory organised like this:
index.html
contact.html
blog/index.html
blog/post-01.html
Running html-merge
on/in this directory will merge each page into its parent page, in-place. HTML files without the appropriate merge-attributes are left untouched.
Install
This should be installed globally:
npm install -g html-merge
And used like this, with an optional target directory:
html-merge <dir>
Attributes
You annotate elements using the merge-replace
attribute, which contains a CSS selector:
New Title!New body!
The tool takes the closest parent (index.html
):
Old title (common content) Old body
And merges your changes into it (in-place):
New Title! (common content) New body!
Since everything without merge-replace=
is ignored, this is equivalent to our original input.