I am writing a less stylesheet for a bi-directional website, and I need to write a single less file and produce two different stylesheets one for left-to-right layouts (ltr) and the other for right-to-lef layouts (rtl)
so when i am styling for rtl layouts, i want to convert every left value to be right, wither it is a float, padding or margin,
to do so, I have defined the required variables at the top of my less file as follows:
@left: right;
@right: left;
simply, i can float elements dynamically like this
float: @left; // this will be floated to left in ltr layout while it will be right in rtl layout.
but my problem is that I want be able also to use these variables to produce dynamic properties, for example when positioning elements absolutely, or relatively, i want to be able to write the left
or right
property dynamically depending on the value of the @left
variable as follows
position: relative;
@left: 10px;
but this gives an error on compiling, any clue how to do that, Note that I have done this using SASS, but till now I couldn't get it to work with LESS ?