Tuesday, June 4, 2013

Convert Twitter Bootstrap css file from LTR to RTL using Node.js R2 Module on Windows 7

I am using this library (twitter bootstrap) a lot on many RTL (Right To Left) sites , But it is not supporting RTL css rules, for that a lot of developers created RTL version of twitter bootstrap css library and that is great if they keep there products up to date .but unfortunately they don't. So we have to find a proper way to help our self solving this issue. How to do that :

First : Download and install Node.js on Windows 7.

Go to Node.js Site Download page and Download Node.js Installer . be sure to check the npm option to be installed on your computer from the installation wizard :



What is Npm ?
Npm is Node Packaged Modules where you can find a lot of modules that work with node.js to ease a lot of functions that you don not need to create by your self like Mysql Package which is A node.js driver for mysql.

Second: Download  and install Node.js Module (R2):

From the Command line Just enter this  command :

npm install -g R2

-g : this attribute will add R2 to the system path so you can Run it from any place.

 Third: Run R2 on the LTR css file to convert it to RTL css file.

go to the folder that contain your css file that you want to convert it and from the command line type the following :

r2 [the name of the original ltr file] [the name of the rtl file]
In the twitter bootstrap case we neet to do the following:
r2 bootstrap.css bootstrap.rtl.css

And hopppppaaa     .................

No comments:

Post a Comment