HTML sourcemap convention

40 Views Asked by At

Per the Source Map spec §6.2:

There are two suggested ways to link source maps to the output. The first requires a server support to add a HTTP header and the second requires an annotation in the source.

The HTTP header should supply the source map URL reference as:

SourceMap: <url>

[…] The generated code should include a line at the end of the source, with the following form: […]

This recommendation works well for JavaScript, it is expected that other source files will have different conventions. For instance, for CSS /*# sourceMappingURL=<url> */ is proposed.

What is the corresponding convention for HTML? My guesses:

  • <!--# sourceMappingUrl=<url> --> after </html>. (Most likely.)
  • <meta http-equiv="SourceMap" content="<url>" /> in <head>.
  • Mysterious third option.

(Answers to a 2013 question suggest there is no browser support for HTML sourcemaps. I care little for browser support, but I do care for convention.)

0

There are 0 best solutions below