Skip to content

Command Line, Modify Var and the "=" Character #3388

Open
@cmerighi

Description

@cmerighi

less.js/bin/lessc

Lines 73 to 76 in 2d43c0b

var parseVariableOption = function(option, variables) {
var parts = option.split('=', 2);
variables[parts[0]] = parts[1];
};

To me, the above lines optimistically consider that no string variables containing an "=" char will ever be passed.
Considering the scenario where:

  • in a less file, I define a selector variable:
@shell_selector: "html";
@shell: (~"@{shell_selector}");

@{shell}{
    /* ... */
}
  • and in a command line:
lessc --modify-var="shell_selector='html[theme=dark]'" src/less/styles.less dist/css/styles-dark.css

The latter fails. The error message includes the line that cannot be interpreted by the parser:
@shell_selector: 'html[theme;
which is the result of the referenced lines of code on top.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions