New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

html-merge-cmd

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-merge-cmd

Merge HTML documents, using CSS selectors

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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:

<title merge-replace="head title">New Title!</title>
<div id="main" merge-replace="#main">New body!</div>

The tool takes the closest parent (index.html):

<!DOCTYPE html>
<html>
	<head>
		<title>Old title</title>
	</head>
	<body>
		<div id="nav">(common content)</div>
		<div id="main">Old body</div>
	</body>
</html>

And merges your changes into it (in-place):

<!DOCTYPE html>
<html>
	<head>
		<title merge-replace="head title">New Title!</title>
	</head>
	<body>
		<div id="nav">(common content)</div>
		<div id="main" merge-replace="#main">New body!</div>
	</body>
</html>

Since everything without merge-replace= is ignored, this is equivalent to our original input.

Keywords

FAQs

Package last updated on 26 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc