# Skulk
*a group (bundle) of foxes*

## Design
Configurable support for factor-bundle, separate Browserify instance(s). Drop insert-css (not needed with split-css).

### stand-alone client app
- dev: Browserify + watchify, Express serves assets + bundles. tiny-lr provides livereload updates
- prod: Generate bundles

### integrated client app
- dev: Browserify + watchify, file serving handled externally, tiny-lr provides livereload updates
- prod: Generate bundles

### client + server
- dev: Browserify + watchify, override file serving for bundles, tiny-lr provides livereload updates
- prod: build step once, run provided Express server

## API
- [ ] multiple bundles
- [ ] factors
- [ ] css type
	- [ ] combined bundle, split

## Implementation
- [ ] configured browserify bundles
- [ ] devmode / prodmode
- [ ] express server
	- [ ] serve static assets
	- [ ] serve bundles from memory
	- [ ] inject (configurable?) livereload script
- [ ] livereload server
- [ ] `debug` logging
- [ ] CSS splitter


- [x] user-supplied config
- [x] get presets from user
- [x] merge supplied presets + config into one config
- [x] get and merge all resulting bundle browserify (preset) configs
result: top-level config, array of browserify bundler configs
- [x] create browserify bundlers for each bundle config
prod mode:
- [ ] execute each bundler once
- [ ] bundle output defaults to top-level output dir, but can be overriden
dev mode:
- [ ] start tiny-lr
- [ ] inject watchify (as preset??)
- [ ] start (internal) express server if configured to do so
	- [ ] writes happen to memory instead of output dir(s)
	- [ ] inject-livereload middleware
	- [ ] express middleware to serve files 
- [ ] bring-your-own server approach (for GTS)
	- [ ] write to disk as usual
	- [ ] send tiny-lr updates
	- [ ] inject livereloading start script in all bundles
		- [ ] also console.log that this is a debug bundle, and should not run in production

- [ ] presets/browserify plugins need a way to 'write' files on their own (skulk-supplied)
- [ ] skulk write function also sends livereload event/update


# Skulk preset
- [ ] preset needs it's own config supplied
- [ ] preset needs access to global config

# Other TODO
- [ ] Do something with cryptic Browserify "TypeError: Path must be a string" on missing deps