Skip to content
This repository has been archived by the owner on Dec 24, 2020. It is now read-only.

Error running color function on Javascript evaluation #42

Closed
mindfullsilence opened this issue Nov 3, 2012 · 3 comments
Closed

Error running color function on Javascript evaluation #42

mindfullsilence opened this issue Nov 3, 2012 · 3 comments

Comments

@mindfullsilence
Copy link

The first 2 lines below works exactly as it should. But using a color function against it throws an error and fails compilation. This is using the node.js precompiler, not the browser processor version.

@start: `'#' + Math.floor(Math.random() * 16777215).toString(16)`;
@color: ~`@{start}`;

.randomColor {
    color: lighten(@color, 20%);
}

errors thrown:

undefined_methodError: error evaluating function `lighten`: Object #<Object> has no method 'toHSL' in /Applications/MAMP/htdocs/CFJ/static/less/randomColor.less:8:8
7 .randomColor {
8   color: lighten(@color, 50%);
@lukeapage
Copy link
Member

Hi, this is a less.js bug... we are trying to suggest people don't use javascript if they can help it..

maybe you could instead add support for this change...

less/less.js#732

@rubensayshi
Copy link

I'm having the same error on ubuntu while others trying to compile the same file on OSX are fine.

lessc -v
lessc 1.3.0 (LESS Compiler) [JavaScript]

node -v
v0.6.12

same problem with node v0.8.16

@lukeapage
Copy link
Member

what you have written will never work. use the color function to convert to a color, e.g.

 @color: color(~`@{start}`);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants