less / less/less-docs

add globalVars usage examples

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

Nobody has claimed this yet.

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

Description

would be nice to clarify that this example

less.globalVars = { myvar: "#ddffee", mystr: "\"quoted\"" };

if for browser only

for Node.JS should be used this code:

var less = require('less');

less.render('.class { width: @width }', {globalVars: {width: 20}}, function (e, css) {
    console.log(css);
});

on in some more advanced cases:

var less   = require('less'),
    parser = new(less.Parser)({
        // some options
    });

parser.parse('.class { width: @width }', function (e, tree) {
    console.log(tree.toCSS({
        // some options
    }));
}, {globalVars: {width: 20}});

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

Locate the documentation section containing the existing globalVars example and compare it with the browser, Node.js, and parser examples in this issue. Update that section to distinguish the usage contexts and include the relevant examples. Done means readers can tell which globalVars form applies to each context.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.