html-inject-at
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

html-inject-at

inject text in an html file at a certain element given a selector

🔧 Install · 🧩 Example · 📜 API docs · 🔥 Releases · 💪🏼 Contribute · 🖐️ Help


Install

$ npm i html-inject-at -g

Usage

Usage: html-inject-at [options] <selector>

                 <selector>  CSS selector where content will be injected

   -i, --input=...           Input HTML file that will be transformed
   -w, --write               Write file in-place ** DANGEROUS! Make sure you have a backup

Examples:
  # Replace body contents with "foo" from stdin, write to stdout
  echo foo | html-inject-at body -i index.html

  # Replace contents in element with id `toc` and write file in-place
  toc index.html | html-inject-at "#toc" -w -i index.html

API

Table of Contents

inject

src/index.ts:42-62

Inject text in an HTML file at a certain element given a selector.

Parameters

  • options Options

    • options.selector CSS selector where content will be injected
    • options.input Input HTML file that will be transformed
    • options.write Write file in-place ** DANGEROUS! Make sure you have a backup
    • options.streamIn Input stream to use (defaults to process.stdin)
    • options.streamOut Output stream to use (defaults to process.stdout)

Contribute

Fork or edit and submit a PR.

All contributions are welcome!

License

MIT © 2021 stagas

Package Sidebar

Install

npm i html-inject-at

Weekly Downloads

18

Version

1.0.2

License

MIT

Unpacked Size

21.9 kB

Total Files

15

Last publish

Collaborators

  • stagas