Skip to content

Single-line comments is consuming newlines #129

@jwilsson

Description

@jwilsson
  • Node Version: 11.5.0
  • NPM Version: 6.5.0
  • postcss Version: 7.0.7
  • postcss-less Version: 3.1.0

If you have a large amount of code to share which demonstrates the problem you're experiencing, please provide a link to your
repository rather than pasting code. Otherwise, please paste relevant short snippets below.

LESS

// Hello world
.foo {

}

JavaScript

N/A

Expected Behavior

An AST similar to this:

Comment {
  raws: { right: '' },
  ...
}
Rule {
  raws: { before: '\n' },
  ...
}

Actual Behavior

An AST similar to this:

Comment {
  raws: { right: '\n' },
  ...
}
Rule {
  raws: { before: '' },
  ...
}

The postcss docs describes the raws.right property as "the space symbols between the comment’s text and */" and postcss-scss only stores actual spaces in raws.right and puts newlines onto the following node. This was the behaviour of postcss-less@2 as well.

How can we reproduce the behavior?

Run postcss-less on the example above.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions