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

Less maps are parsed as the wrong Node type #111

Closed
jwilsson opened this Issue Sep 8, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@jwilsson
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 referenced this issue Sep 17, 2018

Merged

refactor: v3.0 #113

16 of 16 tasks complete
@shellscape

This comment has been minimized.

Show comment
Hide comment
@shellscape

shellscape Sep 19, 2018

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.

Owner

shellscape commented Sep 19, 2018

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.

@shellscape shellscape closed this Sep 19, 2018

@jwilsson

This comment has been minimized.

Show comment
Hide comment
@jwilsson

jwilsson Sep 19, 2018

Collaborator

@shellscape Cool, I can probably work with that.

Collaborator

jwilsson commented Sep 19, 2018

@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