Including livereload.js into your Browserify bundle probably makes no sense, because livereload.js isn't something you would ship to production.īut if you insist and you know what you're doing, you can install LiveReload via npm: npm install livereload-js -saveĪnd then add this to your bundle: window.LiveReloadOptions = This gives you a component containing a single script file, dist/livereload.js. Note that livereload-js package uses window and document globals, so won't run under Node.js environment. This script is meant to be included into the web pages you want to monitor, like this: The reason you need to specify LiveReloadOptions is that livereload.js won't be able to find its tag and would normally bail out with an error message. This approach enables LiveReload when viewing the web page from other devices on the network: LiveReload 2 server listens on port 35729 and serves livereload.js over HTTP (besides speaking the web socket protocol on the same port).Ī slightly smarter way is to use the host name of the current page, assuming that it is being served from the same computer. Options can either be specified as query parameters of the tag's source URL, or as a global window.LiveReloadOptions dictionary. The set of supported options is the same for both methods: If the dictionary is specified, livereload.js does not even try looking for its tag.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |