Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

livereload-inject-cli

An npm CLI for injecting the LiveReload <script> snippet

readme

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