For example with a simpler static server like ecstatic or simply python -m SimpleHTTPServer. This plugin is meant as an alternative to the connect-livereload middleware or a browser plugin. This modifies the original html-file by embedding the livereload-snippet, therefore you should not pipe it back into the same directory where you keep the original files.Īlone, this plugin does not really do much interesting stuff, but combined with gulp-livereload and a static server you get a neat workflow. Ive been using live.js and pythons SimpleHTTPServer for pretty much the same. Normally you would not need to change this, only when serving livereload with a proxy for instance. Does this have any advatange over just using the livereload extension. The source of the livereload script provided (not by gulp-embedlr). Collectively, this makes it so that any change to a source file causes the server to reboot and therefore break the. This server can easily be accessed by a different device on your network via the IP of your host system. to start the server in the current directory (or replace. When you make a change to any file, the browser will reload the page - unless it was a CSS file in which case the changes are applied without a reload. Run npm install -g browser-sync in your shell to install the Browsersync-module globally ( -g) on your system and browser-sync start -server -files. This will automatically launch the default browser. Alternatively you can add the path to serve as a command line parameter. Have that script reload the page when the connection closes. Issue the command live-server in your project’s directory. Inject a script into served HTML files that opens a websocket client. options.srcĭefault: "' + (location.protocol || 'https:') + '//' + (location.hostname || 'localhost') + ':" + port + "/livereload.js?snipver=1" Run the dev server with nodemon so that it will be rebooted whenever any source file changes. Status: beta (expected to work, but not tested in production yet). Then, add it to your gulpfile.js: var embedlr = require( "gulp-embedlr") Implementation of the server side of the LiveReload protocol in Node.js a component of LiveReload.app and some other projects. Plugin for embedding a livereload snippet in html files for gulp Usageįirst, install gulp-embedlr as a development dependency: npm install -save-dev gulp-embedlr
0 Comments
Leave a Reply. |