Skip to content
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

fixed parsing of parametric mixins & update ESLint dependencies #27

Merged
merged 1 commit into from
Mar 28, 2016

Conversation

webschik
Copy link
Contributor

No description provided.

@webschik webschik merged commit 7e743aa into master Mar 28, 2016
@webschik webschik deleted the webschik.parametric-mixins branch March 28, 2016 10:35
const root = parse('.foo(@bar) { color: @bar;}', {mixinsAsAtRules: true, innerMixinsAsRules: true});

expect(root.first.type).to.eql('atrule');
expect(root.first.params[0].type).to.eql('atrule');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eesh. disagree with that choice. adding lessType is just conflating what the syntax is supposed to handle. the entire purpose of a postcss syntax is to direct the parser on how to handle language-specific elements. all this does is tell the parser to continue on as normal while adding a tiny bit of metadata.

also, params should contain the same container convenience methods, or be inserted as child nodes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would like to handle many LESS features: params, all types of mixins, 'rest' params, etc. At the same time PostCSS supports a few syntax constructions: Declarations, AtRules, Rules, Comments. So I try to parse LESS within these limits and the things like 'lessType' are hacks to provide some additional capabilities for 3rd-party libraries.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

going down that road will mean that postcss-less is a monkeypatch (not in a bad sense at all) more than a true syntax (postcss-scss for example, is a true syntax). if that's your plan moving forward, please consider renaming the module and opening the door for a true syntax in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shellscape, I see your point. I think you're right, I have to extend the parsed tree from postcss-less and use not only nodes from API of PostCSS, but all custom nodes should have similar syntax and structure as nodes AtRule, Rule, etc. I think it will be done in the next version of postcss-less

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patsissons, what do you think about it, especially from Stylelint side?

I propose to add custom MixinNode (similar to AtRule or Rule in PostCSS), MixinParam (maybe similar to Declaration in PostCSS), ExtendNode (~Rule) nodes and extend stringifier of postcss-less.

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 this pull request may close these issues.

2 participants