leafo / lessphp

LESS compiler written in PHP
http://leafo.net/lessphp
Other
2.2k stars 528 forks source link

RTL stylesheet #138

Open shazdeh opened 13 years ago

shazdeh commented 13 years ago

The way I handled RTL styles for my web projects was that I used PHP to do something like this:

$x = ( is_rtl() ) ? 'right' : 'left'; $nx = ( is_rtl() ) ? 'left' : 'right';

So now I could do something like this: .column { float: <?php echo $x; ?>; margin-<?php echo $nx ?>: 10px; }

This is way better than declaring LTR styles and then reset them for the RTL. I was wondering if the same technique could be implemented with LESSPHP.

mingan commented 12 years ago

Couldn't you just pass variable from PHP during compilation as described in documentation http://leafo.net/lessphp/docs/#setting_variables_from_php?

shazdeh commented 12 years ago

Works only for values, and not directives. So this works: 'float: @x' and 'margin-@x: 10px' fails.