Some languages, including Arabic, Farsi, Hebrew, and Urdu, are written from right-to-left (rtl
). In this recipe, you will learn how to write Less code that can be compiled for rtl
and ltr
languages by leveraging the Less-bidi mixin library.
For this recipe, you will have to download the Less-bidi mixin library from https://github.com/danielkatz/less-bidi. The Less code will be compiled in the browser by using the client-side less.js
compiler, as described in the Downloading, installing, and integrating less.js recipe in Chapter 1, Getting to Grips with the Basics of Less.
In this recipe, you will create the Less and HTML code for the example shown at https://github.com/danielkatz/less-bidi, as follows:
Download and unzip the Less-bidi mixin library into your working directory.
Then, create a
bidi.less
file that contains the following Less code:@import "less-bidi-master/src/bidi.less"; .ltr { .style(ltr); } ...