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

feat: Add support for interpolations #78

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

niksy
Copy link

@niksy niksy commented Apr 6, 2021

Initial support for interpolations. This will add support for parsing more stuff and allow better usage in Sass linters such as Stylelint with Sass plugin.

@niksy
Copy link
Author

niksy commented Apr 7, 2021

@TrySound @alexander-akait should I write more tests for this?

@niksy
Copy link
Author

niksy commented Apr 16, 2021

Any chance of getting this merged? Can I help with something more?

@alexander-akait
Copy link
Collaborator

This parser only for CSS, supporting non standard CSS is out of scope, sorry

@niksy
Copy link
Author

niksy commented Apr 19, 2021

Don’t see why this shouldn’t be considered as option? postcss-values-parser supports this as option, but this plugin is more widely used as value parser so other tools could benefit from this (e.g. linters as I mentioned in original post).

Maybe you could consider adding support for custom parsers?

@alexander-akait
Copy link
Collaborator

/cc @TrySound

@TrySound
Copy link
Owner

TrySound commented May 1, 2021

I'm not against this if there is a real use case.

@niksy
Copy link
Author

niksy commented May 3, 2021

I’ve referenced issue in Stylelint Sass plugin.

I would think interpolations are something like extension of CSS functions, where they can contain every other CSS property which this plugin parses.

They’re exactly like JavaScript template literals expression interpolations. By default, this plugin wouldn’t parse them, but if you introduce concept of interpolation prefix, they would get properly parsed and allow to handle much more cases in linters.

Also, they’re not only available for Sass, Less also supports them.

@niksy
Copy link
Author

niksy commented Jun 4, 2021

@TrySound @alexander-akait is there something else that needs to be done before this is merged and released?

@niksy
Copy link
Author

niksy commented Jul 8, 2021

@TrySound @alexander-akait can I somehow help with this?

@niksy
Copy link
Author

niksy commented Jul 26, 2021

@TrySound I see the changes have been approved by you. Is it possible to get this merged and published in new version?

@niksy
Copy link
Author

niksy commented Sep 8, 2021

@TrySound any progress on this? It would be really helpful to have this merged since there are some tools which rely on this functionality.

@gdorsi
Copy link

gdorsi commented Sep 14, 2021

Hello there!

I've been using this code for a small hack project of mine.
So helpful, thanks for your job!

I've found that -#{$var} isn't recognized as an interpolation while i think that it should be.

Also the parser function signature type hasn't been updated with the new optional option object.

Hope that you find this information helpful!

@niksy
Copy link
Author

niksy commented Sep 14, 2021

@gdorsi yeah, you’re right, this should also be interpolation. Do you have implementation with fixed code?

@gdorsi
Copy link

gdorsi commented Sep 14, 2021

Hello @niksy!

I haven't fixed the issue by myself but with the latest changes that you made everything works fine.

I've tested this code over a large codebase and I haven't encountered any other issues.

Thanks!

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.

4 participants