griddle
v0.1.2
Published
Express middleware for executing gulp builds and reporting errors in the browser.
Downloads
54
Maintainers
Readme
griddle
Express middleware for executing gulp builds and reporting errors in the browser.
Installation
Install via npm:
npm install griddle
Usage
Let's assume our client source files built via gulp
exist in client/src
and
are built to to client/build
and we have a gulpfile.js
in client
defining a
default build task.
var express = require('express');
var app = express();
express.use(griddle('client', 'client/src'))
express.use(express.static('client/build'));
// Requests to 8080 will serve the built results
express.listen(8080);
A build will be performed every time the express server is started. If a valid watch path is specified changes to files in that directory will also trigger a build.
That's it! If you try to hit the server while it's building you'll have to wait until it's complete.
If one of your builds results in an error, you'll see it like so in the browser:
API
griddle(src, watch, template)
- src
- string
- Required
- Path to the project that should be built.
- watch
- [string=undefined]
- Optional
- Path to the directory that should be watched for changes. As changes occur a gulp build will be triggered.
- template
- [string=undefined]
- Optional
- Optional view name which you'd like to handle build errors.