Skip to content

Sourcemaps break when output set to compressed and variable interpolation  #2319

@JoshMoreno

Description

@JoshMoreno

Setup:

sassc: 3.4.1
libsass: 3.4.3
sass2scss: 1.1.0
sass: 3.4

Bug

I found this bug from compiling bootstrap. It's located in _breadcrumbs.scss - https://github.com/twbs/bootstrap-sass/blob/master/assets/stylesheets/bootstrap/_breadcrumbs.scss

I simplified/isolated the code for debugging. Note that In their original code they linked to - #1115

$breadcrumb-separator: "/" !default;
$nbsp: "\00a0";

.bug {
    content: "#{$breadcrumb-separator}#{$nbsp}"; // Unicode space added since inline-block means non-collapsing white-space
}

The desired result is

.bug { content: "/\00a0"; }

But all the output styles (nested, expanded, compact, compressed) return

.bug { content: "/ "; }

Sourcemaps Issue

On top of that the main issue (for me at least) is that when the output style is set to compressed then source maps become inaccurate. They get created, but the point to wrong files/wrong lines.

I attached a simple demo project to illustrate the bug.

Demo Project

libsass-bug.zip

In the project open the index.html file and inspect the #footer. You'll see the sourcemap pointing to the _header.scss instead of the _footer.scss. If you compile using a different output style this problem goes away, but as I mentioned above, the output for the .bug content property is constant regardless of the output style.

I hope that's enough info. If you need something else, let me know!

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