kriswallsmith/assetic — pull request #689 by nsams (2014-12-14 20:22:48+00:00)
Title: [WIP] SourceMap dumping

(This is WIP, I want to get early feedback for)

Implement SourceMap dumping (see http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/, #208, #558)

- filters generate/modify sourcemaps
- AssetCollection concats sourcemaps
- handle files without sourcemap in AssetCollection

This is implemented using an external library https://github.com/koala-framework/sourcemaps

Currently only implemented for:

- CoffeeScriptFilter
- UglifyJs2Filter

TODO:
- [ ] Review API
- [ ] Implement other Filters
- [ ] Write Unit Tests
- Performance
- [ ] don't execute filters twice (second call for source maps)
- [ ] don't generate any source map data at all if they are not used
- [ ] Caching (with fast concat of sourcemaps)
- [ ] implement in AssetsWriter

Tested with:

$js = new FileAsset('js/foo.coffee', array(new CoffeeScriptFilter()));
$js = new FileAsset('js/xx.js', array(new UglifyJs2Filter()));
$js = new FileAsset('js/foo.coffee', array(new CoffeeScriptFilter(), new UglifyJs2Filter()));
$js = new AssetCollection(array(
new FileAsset('js/xx.js', array(new UglifyJs2Filter()))
));
$js = new AssetCollection(array(
new GlobAsset('js/*.coffee', array(new CoffeeScriptFilter())),
new GlobAsset('js/*.js', array()),
), array(
new UglifyJs2Filter()
));
var_dump($js->dumpSourceMap());