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

rtl-css-transform-webpack-plugin

v1.0.6

Published

Webpack plugin for transforming CSS from LTR to RTL.

Downloads

6,628

Readme

RTL CSS Transform Webpack Plugin 💎

npm version Dependency Status Build Status

Webpack plugin that implements RTLCSS framework for transforming Left-To-Right (LTR) Cascading Style Sheets (CSS) to Right-To-Left (RTL).

Before you should use a CSS extraction plugin. For Webpack v4 we use mini-css-extract-plugin to extract CSS from JS.

rtl-css-transform-webpack-plugin creates RTL CSS file per LTR CSS file:

style.css

.example {
   direction: ltr;
   margin: 0;
   padding: 1em 2em .5em 1em;
   background-color: #353639;
   font-family: "Droid Sans", sans-serif/*rtl:prepend:"Droid Arabic Kufi",*/;
   font-size: 16px/*rtl:14px*/;
}

style.rtl.css

.example {
   direction: rtl;
   margin: 0;
   padding: 1em 1em .5em 2em;
   background-color: #353639;
   font-family: "Droid Arabic Kufi","Droid Sans", sans-serif;
   font-size: 14px;
}

Features 😛

  • [x] Full RTLCSS options, plugins & hooks support
  • [x] CSS modules & Code splitting compatible
  • [x] Source map for debugging
  • [x] Support Webpack v4

Install

npm install rtl-css-transform-webpack-plugin --save-dev

Usage

const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const RtlCssPlugin = require("rtl-css-transform-webpack-plugin");

module.exports = {
    entry: path.resolve(__dirname, "src", "index.js"),
    output: {
        path: path.resolve(__dirname, "dist"),
        filename: "[name].js",
        chunkFilename: "[name].js" // only for code splitting
    },
    plugins: [
        new MiniCssExtractPlugin(),
        new RtlCssPlugin()
    ],
    module: {
        rules: [
            {
                test: /\.css$/,
                use: [
                    MiniCssExtractPlugin.loader,
                    "css-loader"
                ]
            }
        ]
    }
}

Filename

This option determines the name of each output bundle.

The default file name is [name].rtl.css.

See webpack output filename for more details.

new RtlCssPlugin({
    filename: "rtl/[chunkhash].css"
})

Sourcemap

Produces inline source map. Disabled by default.

Source mapping can be enabled via sourcemap option.

new RtlCssPlugin({
    sourcemap: true
})

Alternatively it can be enabled using webpack devtool option.

webpack --devtool source-map

Minimize

Using built-in webpack optimization via production option.

webpack -p

Alternatively see mini-css-extract-plugin optimization recommendation.

RTLCSS options

RTLCSS usage can be customized using object config.

Options are same as RTLCSS options.
Plugins are same as RTLCSS plugins.
Hooks are same as RTLCSS hooks.

new RtlCssPlugin({
    config: {
        options: {},
        plugins: [],
        hooks: {}
    }
})

💐 Special thanks to @MohammadYounes for RTLCSS.