less / less/less-docs

Current "variables in import statements" limitations.

Open
#388 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

up-for-grabs
Dominant language
Less
Stars
680
Forks
442
PR merge metrics
No merged PRs in 30d

Description

Specifically #2772.

Probably it would be helpful to document that @import statement is evaluated "right away" before anything else (specifically mixins). Or, in other words, that it's a sort of "static" statement and it's evaluated exactly where it appears. E.g. when we write something like:

.mixin() {
    @import "something";
}

the code is literally equal to:

.mixin() {
    <the content of the "something" file>
}

thus mixin parameters cannot be interpolated in such import statements, because the import is unconditionally expanded/resolved at the point of the mixin definition (and not when we call/invode that mixin) when and where the mixin parameters values are yet unknown.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading issue #2772 and the existing documentation for Less @import statements. Document that imports are evaluated at their definition point, before mixin parameters are known, and include the example showing why parameter interpolation cannot work; done means the limitation and its timing are clear to users.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.