Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

[RFC] Source maps - General #605

@am11

Description

@am11

(Redirected from: #601 (comment), credit to @mgreter)

This is a general source-maps issue. It covers all the source maps progress. Going by LESS CLI, it provides these options:

 --source-map[=FILENAME]  Outputs a v3 sourcemap to the filename (or output filename.map)
 --source-map-rootpath=X  adds this path onto the sourcemap filename and less file paths
 --source-map-basepath=X  Sets sourcemap base path, defaults to current working directory.
 --source-map-less-inline puts the less files into the map instead of referencing them
 --source-map-map-inline  puts the map (and any less files) into the output css file
 --source-map-url=URL     the complete url and filename put in the less file

the description of last line is confusing, it is basically for sourceMappingURL in output CSS file. see less/less.js#2264

Here we will investigate the progress being made for open issues: #498, #444, #324 and #212.

Following are the requirements:

  • Report correct columns and lines, matching the "index base" for of other transcompilers: ruby-sass, less, coffeescirpt and since so forth.
  • Capture mapping for each token. In the code: body, nav { background: linear-gradient(top, left, #111) center no-repeat #111 }, there are 14 tokens: body, ,, nav, {, background-image, :, linear-gradient, top, left, #111, center, no-repeat, #111 and }.
  • Option for map JSON to be encoded in base64 and set to sourceMappingURL's value in CSS (as opposed to exist as a separate file). An equivalent of LESS' source-map-map-inline.
  • Option to add source-code in sourceContents array in map JSON. Answer to LESS' source-map-less-inline. This comes handy when the source files are not accessible remotely (HTTP?).
  • Ability to set custom URL for sourceMappingURL. if this option is set, it will use the string provided by user as is. Answer to LESS' source-map-url.
  • Add tests; which decode B64 and B64VLQ first and then match the mappings. Also test paths in sourceMappingURL comment in CSS, sources array and file elements in map's JSON.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions