lessphp icon indicating copy to clipboard operation
lessphp copied to clipboard

Latest version getting lots of issues

Open raptor235 opened this issue 12 years ago • 9 comments

Hi there we just upgraded to the latest version and are getting lots of issues... seems like there are some new checks that happen for color variables... ie

expected color value errors occur... the code compiled fine before but now these errors are nested within other files... there is no specific line numbers... so on a file such as

@import '../../core/assets/css/bootstrap/reset.less'; @import 'config.less'; @import 'brand.less'; @import 'variables.less'; @import 'scaffolding.less'; @import '../../core/assets/css/core_mixins.less'; @import '../../core/assets/css/bootstrap/mixins.less'; @import '../../core/assets/css/bootstrap/grid.less'; @import '../../core/assets/css/bootstrap/layouts.less'; @import '../../core/assets/css/bootstrap/type.less'; @import '../../core/assets/css/bootstrap/forms.less'; @import '../../core/assets/css/bootstrap/tables.less'; @import '../../core/assets/css/bootstrap/sprites.less'; @import 'dropdowns.less'; @import '../../core/assets/css/bootstrap/wells.less'; @import '../../core/assets/css/bootstrap/component-animations.less'; @import '../../core/assets/css/bootstrap/close.less'; @import '../../core/assets/css/bootstrap/buttons.less'; @import '../../core/assets/css/bootstrap/button-groups.less'; @import 'navs.less'; @import 'navbar.less'; @import '../../core/assets/css/bootstrap/breadcrumbs.less'; @import '../../core/assets/css/bootstrap/pagination.less'; @import '../../core/assets/css/bootstrap/pager.less'; @import '../../core/assets/css/bootstrap/popovers.less'; @import '../../core/assets/css/bootstrap/thumbnails.less'; @import '../../core/assets/css/bootstrap/carousel.less'; @import '../../core/assets/css/bootstrap/hero-unit.less'; @import '../../core/assets/css/bootstrap/utilities.less'; @import '../../core/assets/css/bootstrap/responsive-utilities.less'; @import '../../core/assets/css/bootstrap/responsive-767px-max.less'; @import '../../core/assets/css/bootstrap/responsive-768px-979px.less'; @import '../../core/assets/css/bootstrap/responsive-1200px-min.less'; @import 'responsive-navbar.less'; @import 'mixins.less'; @import 'header.less'; @import 'content.less'; @import 'footer.less'; @import 'responsive-overrides.less';

we're getting

expected color value: /home/xxx.com/public_html/wp-content/themes/xxx/assets/css/dstyle.less on line 39

where errors are somewhere within the twitter bootstrap...

is there anyway to turn the color validation off or to have more specific error messaging?

we've also noticed that @{images}sprites.png no longer compiles... is this true?

raptor235 avatar Oct 11 '12 13:10 raptor235

It would be great to get a line number and file of where the color variable is not set....

raptor235 avatar Oct 11 '12 17:10 raptor235

Can confirm this issue.

expected color value: failed at `@import "../../bootstrap/less/navs.less";` ~/lib/bootstrap_less/less/bootstrap.less on line 62

The line #62 is the exact line in a file full of @import "file.less"; declarations and the line is the last line in this file. So the error says exactly nothing.

After some investigation I found out that the error comes from ~/lessc/lessc.inc.php#1032 » assertColor(), where the error message is the default message thrown in by the second (optional) argument.

When I var_dump() the $value in this function, I get the following output (actually it's the $value, so more the input):

array
  0 => string 'keyword' (length=7)
  1 => string '' (length=0)

What does this tell me? As there're no phpDocBlocks I can only guess - and the arrays are pretty cryptic regarding their content.

The function has a call to coerceColor( $value ); that has a switch and then triggers for keyword. But as the arrays 2nd value (the name) stays empty, it returns null. That's so far what I've traced back.

I don't know where I could step back anymore, as assertColor() gets called by: lib_hue(), lib_saturation(), lib_lightness(), lib_mix() - twice - and colorArgs(). This makes it (as said: without phpDocBlocks) extremely hard to see where the error comes from.

franz-josef-kaiser avatar Oct 13 '12 01:10 franz-josef-kaiser

I can confirm this issue is still open for lessc version 0.3.9 and Twitter Bootstrap 2.3.2 as described by @franz-josef-kaiser

feeela avatar May 29 '13 10:05 feeela

same issue here

younes0 avatar Jun 18 '13 10:06 younes0

I can confirm this issue in Twitter Bootstrap 2.3.2

magi2c avatar Jun 25 '13 13:06 magi2c

I confirm it for Twitter Bootstrap 3.0.0 I'm getting

expected color value: failed at `color: lighten(@text-color, 25%);

with:

color: lighten(@text-color, 25%);

Subv avatar Aug 30 '13 22:08 Subv

@Subv, I have same error

max-mykhailenko avatar Sep 13 '13 12:09 max-mykhailenko

Same error here.

TomasVotruba avatar Jan 11 '14 08:01 TomasVotruba

I've also hit this issue in a number of WordPress themes attempting to save and compile invalid colors, so I patched this method to skip over throwing an error and revert back to returning rgb(0,0,0):

protected function assertColor($value, $error = "expected color value") {
  $color = $this->coerceColor($value);
  // if (is_null($color)) $this->throwError($error);
  // NOTE: Dirty hack to fix issues where the theme would try to compile invalid colors
  if (is_null($color)) $color = array('color', 0, 0, 0);
  return $color;
}

Maybe that will save somebody else from the frustration of the useless stack trace.

ezekg avatar Jul 13 '16 22:07 ezekg