Skip to content

LESS own syntax for Custom Properties  #2968

Closed
@katerlouis

Description

@katerlouis

I really do not like the syntax of custom properties and I want to suggest a simple "search&replace" solution for a preprocessor. (At least my layperson mind things it's ez to implement :O)

actual syntax

--my-font: Awesome Font;
font-family: var(--my-font, Robot, Helvetica); / with fallbacks

my suggestion

$my-font: Awesome Font;
font-family: $(my-font, Robot, Helvetica);

or

$color: #ff92ea;
$color2: #22adf2;
border: 2px solid $$color;
background: linear-gradient($$color, white, $(color2, yellow));

The idea put in words:
Declaration = $ 1 Dollar
Usage = $$ 2 Dollars OR $() 1 Dollar + parenthesis (maybe use 2 here aswell for consistency?)
LESS then compiles to actual custom property syntax

PROS
– Much easier to write and read
– The $ is easy to distinguish from the LESS-var @.
– Developers are used to the $ from jQuery and PHP
– Sass users will we confused 😎

CONS:
– Sass users will be confused 😭

What do you say?

PS:
please assign "Suggestion" / "Feature Request" label; I am not allowed to :(

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions