bolinfest/plovr — pull request #4 by tschaub (2013-07-23 18:11:37+00:00)
Title: Source map improvements

Originally filed as [issue 70](https://code.google.com/p/plovr/issues/detail?id=70).

The source maps served by Plovr could be made more useful in a couple ways.

By including the `X-SourceMap` header in the compiled source response, clients that support source maps can request the source map.

The `sources` member in the source map generated by Closure Compiler do not map to the paths where Plovr serves the source files. Ideally, the `sourceRoot` could be configured, but it doesn't appear that the Source Map v3 generator supports this (see [Closure Compiler issue 770](http://code.google.com/p/closure-compiler/issues/detail?id=770)).

As a workaround for the missing `sourceRoot`, the source map location mappings option can be set on the compiler. Whereas before the `sources` member in a source map might have looked like the following:

```js
"sources": ["/closure/goog/base.js", "app.js"]
```

It would now look like this:

```js
"sources": ["/input/{id}//closure/goog/base.js", "/input/{id}/app.js"]
```

Where `{id}` is replaced by the config id.

I couldn't find a good place to write tests for this, but with these changes, source maps from Plovr work for me in Chrome.