Skip to content

Problem with comments and breakline #18

Closed
@renatocassino

Description

@renatocassino

Hello guys.

I'm using this lib and I found a bug.
After all comments in scss, the tokenizer ignore the next breakline.

Example:

For this simple css:

.product {
  &__description {
    color: #F00;
    border: 1px solid #ccc;
  }

  div ul li {
    height: 20px;
  }

  /* Comment */
  &__title {
    &--active {
      color: #33dd33;
    }

    background: #f00;
  }
}

The word title appears in line 12, but the tokenizer showing line 11.

[
	// ..........
	["newline", "\n", 10, 0],
	["newline", "\n", 11, 0],
	["space", "  "],
	["startComment", "/*", 11, 4],
	["space", " "],
	["word", "Comment", 11, 123, 11, 129],
	["space", " "],
	["endComment", "*/", 11, 132], // <-- HERE END COMMENT IN LINE 11
	["space", "  "], // <-- Space instead of newline
	["word", "&__title", 11, 136, 11, 143], // <-- Line 11 again
	["space", " "],
	["{", "{", 11, 145],
        // ........
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions