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

Add support for @apply rule to apply mixins #4285

Closed
wants to merge 1 commit into from

Conversation

QtKaii
Copy link

@QtKaii QtKaii commented Nov 12, 2024

Closing this PR as the functionality is already supported in Less.js without needing an @apply rule. As matthew-dean pointed out, mixins can be used directly like:

.mixin() {
  color: blue;
  font-size: 12px;
}

.test {
  .mixin();
}

No need for @apply syntax since this is already part of the language.

This implements less#3675 by adding:
- New ApplyRule node type for handling @apply rules
- Parser support for @apply syntax
- Test cases to verify functionality
@QtKaii QtKaii marked this pull request as ready for review November 12, 2024 22:37
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 12, 2024
@QtKaii
Copy link
Author

QtKaii commented Nov 12, 2024

Tests pass :)

@matthew-dean
Copy link
Member

This code change doesn't have anything to do with #3675, which has to do with being more forgiving about evaluating at-rules when assigned to a custom property. Using @apply to use a mixin is not necessary; it's already supported by the language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants