less.ruby icon indicating copy to clipboard operation
less.ruby copied to clipboard

Variable reference in alpha slot of rgba causes an error

Open caleb opened this issue 16 years ago • 2 comments

The following causes an error when processed with less:

@op: .5;

#title-bar {
  background-color: rgba(0, 0, 0, @op);
}

This is the output of lessc:

/Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/polyglot-0.2.9/lib/polyglot.rb:78:in `max': comparison of Less::Node::Variable with 0 failed (ArgumentError)
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/literal.rb:77:in `each'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/literal.rb:77:in `max'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/literal.rb:77:in `normalize'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/literal.rb:22:in `initialize'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/function.rb:18:in `new'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/function.rb:18:in `rgba'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/function.rb:77:in `send'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/function.rb:77:in `evaluate'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/function.rb:66:in `to_css'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/property.rb:83:in `to_css'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/property.rb:83:in `map'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/property.rb:83:in `to_css'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/element.rb:154:in `to_css'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/element.rb:153:in `map'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/element.rb:153:in `to_css'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/element.rb:168:in `to_css'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/element.rb:166:in `map'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine/nodes/element.rb:166:in `to_css'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/engine.rb:47:in `to_css'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/command.rb:57:in `parse'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/../lib/less/command.rb:50:in `run!'
    from /Users/caleb/Applications/ruby-1.8.7-p174/lib/ruby/gems/1.8/gems/less-1.2.11/bin/lessc:92
    from /Users/caleb/Applications/ruby-1.8.7-p174/bin/lessc:19:in `load'
    from /Users/caleb/Applications/ruby-1.8.7-p174/bin/lessc:19

caleb avatar Nov 13 '09 18:11 caleb

This would be nice to fix; it would make it easy to create cross-browser color declarations with one line!

schwa23 avatar Feb 11 '10 01:02 schwa23

Absolutely, same error I have with the ruby less compiler.

Rendez avatar Dec 29 '10 12:12 Rendez