@jamen/dev-server
v2.0.0
Published
Watch files, execute build scripts, and launch an auto-reloading dev server.
Downloads
7
Readme
@jamen/dev-server
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 to3000
).--host
,-h
Changes host of the server (defaults tolocalhost
).--open
,-o
Automatically opens page in browser (defaults tofalse
).--gzip
,-g
Compress each file and serve as*.gz
. (defaults tofalse
).--ssl
,-S
Enables HTTPS with a key and cert (defaults tofalse
).--cert
,-C
Certificate file for HTTPS (defaults tocert.pem
).--key
,-K
Key file for HTTPS (defaults tokey.pem
).--cors
Enable CORS on the server (defaults tofalse
).--ignore
,-i
Array of globs to exclude from--watch
(defaults tonode_modules
and.git
).
Without a directory to serve from, defaults to ./dist