Skip to content

bengourley/hot-rld

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hot-rld

Hot reload for css/js files.

Usage

Start a web server that will watch your static asset bundles (js/css) for changes and notify the client via SSE.

The client will replace the <script> or <link> elements with the updated (and cachebusted) link, causing the browser to load the new contents.

hot-rld -s static js/*.js css/*.css ...
  • -s is the path to where your static assets are served from
  • followed by one or many globs to files to watch, relative to the static assets

Tip: prefix this command with ./node_modules/.bin/ if it's not already in your path.

Inject the tiny client script in your development page. This speaks to the SSE server and injects new builds of your bundle as and when they are created:

const html = `<script>${require('hot-rld/client')}</script>`

Installation

$ npm install --save-dev hot-rld

or

$ yarn add --dev hot-rld

Known issues

Replacing an entire js file is likely to cause a ton of side-effects, so be mindful of what you use it on. This was built for choo apps which are functional in nature. However, subscriptions and other one-time setup side effects can still be a pain. You have been warned 😔!

License

MIT

About

Hot reload for js/css files.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •