UNPKG

miru

Version:

web development server for bundlers and/or static files, parses terminal and DOM errors ( inline sourcemaps supported )

88 lines (64 loc) 5.3 kB
Usage: miru [options] Options: -p, --path <dir> Specify path (current directory by default) Usually path to public directory. This is also the path where miru creates "miru-connect.js" which you should <script src="miru-connect.js"> on your html page to enable live reloads and error reporting directly within the page/browser. -w, --watch [ <command> -o <file> [-r '/regexPattern/'] ] Specify watch command and target file bundle and optionally a regex pattern for triggering reload events. When the regex pattern matches the stdout of the watch process an event is sent to all connected clients to reload or refresh their js/css. miru-connect.js refreshes corresponding <link href="file.css"> or reloads <script src="file.js"> tags on the html page where <script src="miru-connect.js"> is loaded. "miru-connect.js" is created inside the --path directory when miru starts -t, --targets <file> Add arbitrary target files not linked to a watch process. When these files change, they will send a reload event (or css refresh if they are css files) to all connected clients. styles ( *.css ) are attempted to refresh if the basename is found on a link tag inside the DOM. This makes live editing CSS super fast and smooth. scripts ( *.js ) and all other files trigger a page reload. miru-connect.js will listen for DOM Errors -- and if the basename of the source file of the error matches a file in --targets then it will pass the error back to the miru.js sever for parsing. The parsing is done by wooster and the result is sent back to the client. The parsed error output is then rendered on the screen for easier debugging. Inline source maps are supported: If the target file includes inline source maps then the parsed output includes the source map as well. -r, --reload Always force a page reload when a change event is emitted. This disables css quick refreshing. -f, --files <file> Watch arbitray files for changes and execute commands. -e, --execute <command> Execute commands when any of the --files have changed. '$evt' and '$file' strings in the <command> parameter are substituted accordingly. eg: miru -f package.json -e 'echo $evt: $file' --csslint Lint ( and show errors ) target css files after changes. --jslint Lint ( and show errors ) target js files after changes. --lint Lint both css and js target file errors ( same as setting both --csslint, --jslint ) -v, --verbose Enable verbose mode -P, --port Set port to run on (default port 4040) -A, --address Set address to run on (default 0.0.0.0) -V, --version Display miru version -h, --help Display help information (this text) STDIN Terminal Commands: the miru process listens for line separated std input devices prints a numbered list of connected client/device information logs <number> list console.log output of <number> client ( or all clients if undefined ) recovery prints recovery watcher ( if watcher exits ( should not happen, fix your watcher script ) ) previous prints out previous error lan, ip, address prints out LAN address ( use this address to connect from other devices ) watchers prints watcher commands and targets targets prints watch targets ( set by --targets and --watch ) files prints watch files ( set by --files ) executions prints executions ( set by --execute ) error prints active watcher errors ( or empty if nothing is active ) pesticide <bool> enable or disable pesticide ( css debugger ) on all connected clients