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.

Sourcemaps have wrong line numbers for rules with parent selectors #2204

@squidfunk

Description

@squidfunk

Wrong line numbers break tests relying on sourcemap information

We are trying to integrate Gemini screenshot testing with coverage information which itself relies on the generated sourcemaps. The coverage report is not generated correctly because of wrong line numbers, which we traced back to libsass's sourcemap generation. The behavior differs from Ruby Sass, which generates the correct sourcemaps line numbers and offsets.

When compiling the SCSS source with line number information, the line numbers inserted in the generated source are correct, whereas the line numbers included in the sourcemap are wrong. Both rules point to line number 1:

input.scss

.foo { // line 1
  background: red;

  &-bar { // line 4
    background: green;
  }
}

libsass 3.3.6

sassc -l --sourcemap test.scss test.css
/* line 1, [...]/test.scss */
.foo {
  background: red; }
  /* line 4, [...]/test.scss */
  .foo-bar {
    background: green; }

/*# sourceMappingURL=test.css.map */

bildschirmfoto 2016-10-11 um 21 49 17

ruby sass 3.4.22

sass -l --sourcemap=file test.scss test.css
/* line 1, test.scss */
.foo {
  background: red; }
  /* line 4, test.scss */
  .foo-bar {
    background: green; }

/*# sourceMappingURL=test.css.map */

bildschirmfoto 2016-10-11 um 21 53 27

version info:

$ sassc --version
sassc: 3.3.6-24-geee6
libsass: 3.3.6-144-g50a6-dirty
sass2scss: 1.1.0
sass: 3.4

Help needed?

I'm currently debugging libsass trying to find the source of the problem. Is this issue already known? If not, I would investigate and try to fix the bug.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions