Skip to content

Allow dirname of source path referenced by sourcemap to be customized #155

@mojavelinux

Description

@mojavelinux

By default, the dirname of the source paths referenced by the sourcemap mirrors the src glob. For example, if the source CSS file is css/site.css, then the source paths for each @import when sourcemaps are enabled become css/base.css, etc. However, it's not clear what "css" refers to here, especially if the output folder for the CSS is already "css". Then, you get "css/css/base.css" in the developer tools.

It would be ideal if the base directory were to be named after the file in which the imports were resolved. For example, the sourcemap would instead be site.css-src/base.css.

The line of code I'm looking to be able to customize is this one:

return path.join(path.dirname(file.relative), source)

I'm looking for something like:

return path.join(file.basename + '-src', source)

or even:

return path.join(file.basename + '-' + source)

I'm open to any configuration that would give me control over that line, even if it's a callback function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions