@jamen/dev-server

2.0.0 • Public • Published

@jamen/dev-server

example

Watch files, execute build scripts, and launch an auto-reloading dev server.

Install

npm i @jamen/dev-server

Or use npx

npx @jamen/dev-server

Usage

dev-server <entry> --watch <glob> <command>

Starts a server at entry and creates the given watchers.

$ dev-server dist --watch "src/**/*.js" "make js"
$ dev-server dist --watch "src/**/*.js" "cat $FILE"

Use $FILE inside the command string to access the path.

Allows multiple watchers:

$ dev-server dist --watch "src/**/*.js" "make js" \
                  --watch "src/**/*.css" "make css" \
                  --watch "src/**/*.html" "make html"

The flags available are:

  • --watch, -w Source files to watch and the command to execute.
  • --port, -p Changes port of the server (defaults to 3000).
  • --host, -h Changes host of the server (defaults to localhost).
  • --open, -o Automatically opens page in browser (defaults to false).
  • --gzip, -g Compress each file and serve as *.gz. (defaults to false).
  • --ssl, -S Enables HTTPS with a key and cert (defaults to false).
  • --cert, -C Certificate file for HTTPS (defaults to cert.pem).
  • --key, -K Key file for HTTPS (defaults to key.pem).
  • --cors Enable CORS on the server (defaults to false).
  • --ignore, -i Array of globs to exclude from --watch (defaults to node_modules and .git).

Without a directory to serve from, defaults to ./dist

Readme

Keywords

none

Package Sidebar

Install

npm i @jamen/dev-server

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

10.3 kB

Total Files

4

Last publish

Collaborators

  • jamen