npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

less-plugin-rtl

v2.0.0

Published

ltr to rtl less plugin

Downloads

13

Readme

NPM version Dependencies devDependency Status optionalDependency Status

less-plugin-rtl

Reverses less from ltr to rtl

.reverse {
  float: left;
  margin-left: 5px;
  margin: 1px 2px 3px 4px;
  & when (@rtl) {
    color: green;
  }
}

Becomes...

.reverse {
  float: right;
  margin-right: 5px;
  margin: 1px 4px 3px 2px;
  color: green;
}

To use with lessc

$ npm install -g less-plugin-rtl
$ lessc --rtl file.less out.css

Variables

Three variables are injected ltr and rtl which will be set to true or false and dir which will be set to rtl or ltr.

Property Reversing

To be more in control of properties that get reversed, you can specify property directives

.test {
    -ltr-padding: 0; // rule only appears in LTR
    -rtl-margin: 3px; // rule only appears in RTL
    -ltr-rtl-float: left; // rule does not get reversed in either direction if autoReverse is on
    -rtl-ltr-float: left; // rule does not get reversed in either direction if autoReverse is on
    -ltr-reverse-text-align: left; // rule gets reversed for LTR, so in this case RTL = left, LTR = right
    -rtl-reverse-text-align: left; // rule gets reversed for RTL, so in this case RTL = right, LTR = left
}

Note: The reverse rules only make sense if autoreverse is off.

And this produces in RTL..

.test {
    margin: 3px;
    float: left;
    float: left;
    text-align: left;
    text-align: right;
}

and in LTR...

.test {
    padding: 0;
    float: left;
    float: left;
    text-align: right;
    text-align: left;
}

CLI Options

$ lessc --rtl="dir=LTR auto-reverse=false vars=false" file.less out.css

auto-reverse

Whether rules should be auto reversed or require property directives as above. Defaults to true.

vars

Whether the variables should be available. Defaults to true.

dir

The intended direction. Defaults to RTL.

Programmatic Options

As above, but use dir, vars and autoReverse on the options object.