livereload-inject-cli

1.0.2 • Public • Published

livereload-inject-cli

livereload-inject-cli is a simple CLI tool to inject the livereload JS snippet into a specified file, nothing more. By default the injection is done at the end of <body>. I originally wrote it for a project using npm as a build tool, in need of livereload, and couldn't find a good already existing solution.

An npm scripts use case could look something like this;

"scripts": {
  "watch": "build && (watch-js & watch-scss & livereload & wait)",
  "livereload": "livereload-inject-cli src/index.html dist/index.html && tiny-lr-it ."
}

Usage

livereload-inject-cli <target file path> <destination file path> [OPTIONS]

Where;

<target file path>
    The file to be injected with the livereload <script> snippet

<destination file path>
    Optional. The destination to where the injected file will be written.
    If no destination path is provided it the target file will be overwritten.

[OPTIONS]
    -h, --head    Inject the <script> snippet at the end of <head> instead of
                  <body>, as is the default if this option is omitted.

Contribution

Very welcome! Go nuts.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i livereload-inject-cli

Weekly Downloads

1

Version

1.0.2

License

MIT

Last publish

Collaborators

  • jacobgunnarsson