less / less/less.js

help | how to use(or possibility to) mixin with function?

Open
#3,617 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
JavaScript
Stars
17k
Forks
3.4k
Avg merge
7h 42m
Merged PRs (30d)
26

Description

in my case
first I use function to create a .in-10 ...

@selectors: 5, 10, 20;
each(@selectors, {
    .in-@{value}{
        padding: (@value)px;
    }
});

then use .in-10 as a mixin to .button

.button{
    .background-color:  green;
    .in-10();  /* <--  here to use mixin */
    ...some other
}

an error say .in-10 is undefined, may I think they are output same time so that .in-10 is not find, how can I make this work? how to code less in this case?

I can't got any answer in stackoverflow so I try here, pls help!

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

The issue provides only Less snippets and names no repository files, tests, or entry points. Start by reproducing the undefined-mixin error with the shown selector loop, then review the project's documented semantics for generated mixins; done would require a confirmed explanation or documentation of the supported approach.

Written by the indexing model from the issue text.

Assessment

Domain
frontend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.