Skip to content

Commit

Permalink
Source Map Revision 3 Proposal as of 2013-05-16
Browse files Browse the repository at this point in the history
Co-authored-by: John Lenz <[email protected]>
Co-authored-by: Nick Fitzgerald <[email protected]>
  • Loading branch information
2 people authored and jkrems committed Jan 25, 2022
1 parent 3682cc1 commit c0dc49a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions source-map-rev3.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,18 @@ July 30, 2012 | John Lenz | Modified recommended HTTP header name.
August 20, 2012 | John Lenz | Add CSS linkage recommendation
October 24, 2012 | John Lenz | Add clarifying section on source locations.
February 19, 2013 | John Lenz | Add “sourcesContent” line to support self contained source maps.<p>Added note regarding using data uri to load source maps.
May 16, 2013 | John Lenz | Updated linking convention to use # instead of @. @ conflicts with internet explorer’s conditional code

## License

This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/).


## Discussion

To discuss or propose changes to this specification, please use the dev-js-sourcemap mailing list: [https://lists.mozilla.org/listinfo/dev-js-sourcemap](https://lists.mozilla.org/listinfo/dev-js-sourcemap)


## Background

The original source map format (v1) was created by Joseph Schorr for use by Closure Inspector to enable source level debugging of optimized JavaScript code (although the format itself is language agnostic). However, as the size of the projects using the source maps expanded the verbosity of the format started to be become a problem. The v2 was created trading some simplicity and flexibility to reduce to overall size of the source map. Even with the changes made with the v2 version of the format, the source map file size was limiting its usefulness. The v3 format is based on suggestions made by podivilov.
Expand Down Expand Up @@ -208,18 +214,20 @@ The generated code may include a line at the end of the source, with the followi


```
//@ sourceMappingURL=<url>
//# sourceMappingURL=<url>
```


Note: The prefix for this annotation was initially “//@” however this conflicts with Internet Explorer’s conditional comments and was changed to “//#”. It is reasonable for tools to also accept “//@” but “//#” is preferred.

This recommendation works well for JavaScript, it is expected that other source files will have other conventions:


<table>
<tr>
<td>CSS
</td>
<td>/*@ sourceMappingURL=&lt;url> */
<td>/*# sourceMappingURL=&lt;url> */
</td>
</tr>
</table>
Expand Down

0 comments on commit c0dc49a

Please sign in to comment.