1.0.2 • Published 2 years ago

html-inject-at v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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