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

sourceMap option documentation is inaccurate #2394

Closed

Description

@nex3

The documentation for the sourceMap option claims that

Setting the sourceMap option requires also setting the outFile option

However, in practice, if you set sourceMap to a string and don't set outFile, you still get a map buffer in the result. For example:

var sass = require('node-sass');

var result = sass.renderSync({
  data: 'a {b: c}',
  sourceMap: 'out.css.map'
});
console.log(result.map.toString());

prints

{
        "version": 3,
        "file": "stdin.css",
        "sources": [
                "stdin"
        ],
        "names": [],
        "mappings": "AAAA,AAAA,CAAC,CAAC;EAAC,CAAC,EAAE,CAAC,GAAE"
}

Activity

  1. ericmorand commented on Apr 15, 2019

    @ericmorand

    The Result object description is also inaccurate:

    entry (String) - The path to the scss file, or data if the source was not a file

    As seen on @nex3 example, when the source was not a file, the parh to the SCSS file is not data but stdin.

    EDIT: Actually, I'm wrong, stats Result object is correctly returning "data" as entry path. Still it is inconsistent with the value returned in the source map "sources" which is "stdin".

  2. added a commit that references this issue on Oct 17, 2019
    bc6e11a
  3. self-assigned this
    on Oct 17, 2019
  4. saper commented on Oct 17, 2019

    @saper
    Member

    Thanks for this - there was even a small bug. render() has always provided a map with the undefined value if the map was not requested, unlike renderSync().

    Fixed via #2754

  5. added a commit that references this issue on Oct 21, 2019
    8498f70
  6. added a commit that references this issue on Oct 24, 2019
    fbc9ff5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions