Skip to content

Crash on inline comments without leading space #114

@jwilsson

Description

@jwilsson
  • Node Version: 10.11.0
  • NPM Version: 6.4.1
  • postcss Version: 7.0.2
  • postcss-less Version: 3.0.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

//comment

JavaScript

const postcss = require('postcss');
const syntax = require('postcss-less');

const lessText = '//comment';

postcss([])
  .process(lessText, { syntax })
  .then((result) => {
    console.log(result);
  })
  .catch((e) => {
    console.log(e);
  });

Errors

CssSyntaxError {
  name: 'CssSyntaxError',
  reason: 'Unknown word',
  source: '//comment',
  line: 1,
  column: 1,
  message: '<css input>:1:1: Unknown word',
  input: { line: 1, column: 1, source: '//comment' }
}

Expected Behavior

A Comment node.

Actual Behavior

A crash with the above error.

How can we reproduce the behavior?

Run the provided JS example.

I think I have a fix, PR incoming shortly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions