Skip to content

Less maps are parsed as the wrong Node type #111

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jwilsson opened this issue Sep 8, 2018 · 2 comments · Fixed by #113
Closed

Less maps are parsed as the wrong Node type #111

jwilsson opened this issue Sep 8, 2018 · 2 comments · Fixed by #113

Comments

@jwilsson
Copy link
Collaborator

jwilsson commented Sep 8, 2018

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.

@shellscape shellscape mentioned this issue Sep 17, 2018
16 tasks
@shellscape
Copy link
Owner

This one is tricky. With the work being done in #113, this will be parsed as a regular AtRule with the name property being var: - note the trailing colon. Differentiating between a regular at-rule and a map is going to be tricky, and I'm not sure we have to do that. Going to close for now. If it gets to be a pain on your end, let's revisit after v3.0.0 is out.

@jwilsson
Copy link
Collaborator Author

@shellscape Cool, I can probably work with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants