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

Updating to use detached rulesets, with .keyframes example #142

Open
lourd opened this issue Jan 13, 2015 · 1 comment
Open

Updating to use detached rulesets, with .keyframes example #142

lourd opened this issue Jan 13, 2015 · 1 comment

Comments

@lourd
Copy link

lourd commented Jan 13, 2015

Starting in Less 1.7.0, there is now a feature in Less called detached rulesets.

Detached ruleset is a group of css properties, nested rulesets, media declarations or anything else stored in a variable. You can include it into a ruleset or another structure and all its properties are going to be copied there. You can also use it as a mixin argument and pass it around as any other variable.

Lesshat could be greatly simplified by making use of this feature. For example, the current keyframes mixin is over 2000 characters long when compressed/minified. It can be rewritten in 200 using a ruleset parameter (and no Javascript)

.keyframes (@name, @frames) {
  @-webkit-keyframes @name { @frames(); }
  @-moz-keyframes @name { @frames(); }
  @-ms-keyframes @name { @frames(); }
  @-o-keyframes @name { @frames(); }
  @keyframes @name { @frames(); }
}

Almost all of the mixins could benefit using this feature.

@mboudreau
Copy link
Collaborator

This is good idea. I'll have to look into it. If you (or someone else) wants to do it and create a PR, that would be fantastic.

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

No branches or pull requests

2 participants