less / less/less.js

null string for compiling

Open
#2,831 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description


/* making .display-block */
.make-classes () {
    @item : ~"";
    .make-classes( @item );
}

/* making .xs-display-block */
.make-classes ( @class ) when ( iskeyword( @class ) ) {
    @item : ~"@{class}-";
    .make-classes( @item );
}

/* inner function */
.make-classes ( @class ) when ( isstring( @class ) ) {
    .@{class}display-block { display: block; }
}

.make-classes ();

.make-classes( xs );

If I want to taking .display-block into some class as :

.shi {
    .display-block;
}

it will be tell me

NameError: .display-block is undefined on line 21, column 5:

but if I using .xs-display-block

.shi {
    .xs-display-block;
}

It's works.

so... Is that the null string are not supporting when compiling?

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 compiling the provided Less reproduction and compare the generated .display-block and .xs-display-block mixins. Investigate how the compiler handles the empty string argument versus the keyword argument; done means the reported behavior is explained and the reproduction has a verified expected result.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.