LESS SEPARATE rule set against nonparametric mix

Are there significant differences between a particular set of rules, for example

@detached-ruleset: {
  @margin: 1px;
  margin: @margin;
};

and nonparametric mixin? For instance.

.mixin() {
  @margin: 1px;
  margin: @margin;
}

Do they behave the same with nested statements?

The most obvious difference is syntactic (a semicolon is required for a set of rules), and a set of rules saves its variables as private, but all that I could find. The manual does not cover the details in too much detail.

+4
source share
1 answer

A disabled rule set is a variable. For variables in Less than the last declaration, winnings and variables are lazy loaded.

For reusable code, you can easily extend .mixin () by specifying a second mixin () with the same name:

.mixin() {
  @margin: 1px;
  margin: @margin;
}

.mixin() {
  color: red;
}

, :

@detached-ruleset: {
  @margin: 1px;
  margin: @margin;
};

@detached-ruleset: {
  @margin: 1px;
  margin: @margin;
  color: red;
};

: fooobar.com/questions/1590333/...

+5

All Articles