pvcbuild / pvc

PVC -- Scaffold, Build, Publish -- Composable, extensible builds in .NET created by @stirno
http://pvcbuild.com
MIT License
117 stars 11 forks source link

Watcher #73

Closed stirno closed 10 years ago

stirno commented 10 years ago

Implementation for watcher.. slightly smart, we'll see if its good enough! Works off the pipes rather than complete task re-execution.

stirno commented 10 years ago

To add some details for how this is used/how it works.. the code looks like:

pvc.Source("*.less")
   .Pipe(new PvcLess())
   .Save("deploy")
   .Watch();

The way watches work in PVC is to record the pipeline of plugins executed against the specified glob patterns. When a change happens, in watch mode, we match the change against the globs (in the order we recorded them, which should mimic the order of task execution). If theres a match, we determine whether to re-run the entire glob against the current files on disk or to just run the individual change through the pipeline.

Additionally, sometimes you need to specify additional files to watch, that should trigger execution of the sourced code but not themselves. You can do this:

pvc.Source("app.js")
   .Pipe(new PvcBrowserify())
   .Save("deploy")
   .Watch("components/**/*.js");

This would process your root app.js Browserify entry point but still trigger recompilation on changes to components JS that are included inside the bundle.