Gulp plugin that runs a local server that executes tasks when a page is requested, not when the file changes
Runs a local server that executes tasks when a page is requested, not when the files change
It will keep track of the file changes; but instead of running the tasks directly it will run them all at once when a request arrives, before it hits the real development server.
Install via npm:
npm install gulp-ondemand-server --save-dev
var gulp =OnDemandServer = ;gulp;
NOTE: If you want custom local domains in Linux, you can edit /etc/hosts and copy-paste the localhost line with the new domain.
globs- array of globs of files to watch for changes.
tasks- array of tasks to run when a requests arrive and the files have changed.
Both globs and tasks can be a single string too.
host- the host we're registering
proxyUrl- the target URL for the proxy; protocol, host and port only. E.g.:
You should register all hosts you want to use before starting the server (calling this function as much as needed).
port- the port we'll listen to
All registered hosts will share this port.
Mainly because I have a not-so-good laptop that doesn't keep up compiling every time I change the Sublime tab (and autosaves).
With this plugin I can develop and save as much as I want, and it will execute only the needed tasks before any request hits the real page (when I refresh the page).