Skip to content

Less maps are parsed as the wrong Node type #111

Closed
@jwilsson

Description

@jwilsson

Originally filed at lesshint/lesshint#492

  • Node Version: 10.10.0
  • NPM Version: 6.4.1
  • postcss-less Version: 2.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

@var: {
    color: blue
};

This is apparently a new feature just released a few months ago (http://lesscss.org/features/#maps-feature).

JavaScript

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

const lessText = `@var: {
    color: blue
};`;

postcss([])
  .process(lessText, { syntax: syntax })
  .then(function (result) {
    console.log(result.root.first)
});

Expected Behavior

To be parsed and returned as a Declaration node, like other variable assignments (e.g @var: blue).

Actual Behavior

It's parsed and returned as a Rule node.

How can we reproduce the behavior?

Run the provided JS example.

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