Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass options object to parser.parse in less.render #1921

Merged
merged 1 commit into from
Aug 25, 2014

Conversation

rback
Copy link

@rback rback commented Mar 10, 2014

The options object is not passed to less.Parser.parse in less.render. This means that variables can't be overridden with modifyVars.

The tests for this pass because lessTester.runTestSet does not call less.render, but instead calls less.Parser.parse directly.

test/modify-vars.js contains a test that uses less.render to demonstrate the bug.

@rback
Copy link
Author

rback commented Mar 11, 2014

This is more of a bug report than a proper pull request. I ran into this issue when trying to use modifyVars with gulp-less. I quickly compared gulp-less to the command line lessc and grunt-contrib-less, to see how it differs.

Gulp-less uses less.render which won't work because of this issue.

The command line lessc calls less.Parser.parse directly without passing modifyVars. Instead it modifies the input data before the call.

The grunt task works similarly to lessc. It also modifies the input data before calling less.Parser.parse.

Modifying the input data before calling the parse method seems unnecessary, since the parser appears to do this, if passed the appropriate additionalData.

Is less.Parser.parse the recommended way to use less as a library? I can make a PR to gulp-less if this is the case.

@blaugueux
Copy link

+1

@ashley7070
Copy link

would like this to be implemented as well

@xpavelf
Copy link

xpavelf commented Jun 3, 2014

+1

lukeapage added a commit that referenced this pull request Aug 25, 2014
Pass options object to parser.parse in less.render
@lukeapage lukeapage merged commit dc691d6 into less:master Aug 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants