Skip to content

Latest commit

 

History

History
executable file
·
57 lines (40 loc) · 1.57 KB

readme.md

File metadata and controls

executable file
·
57 lines (40 loc) · 1.57 KB

rtlcss-stylus

A simple Stylus middleware wrapper for the excellent rtlcss

npm tests

Installation

You can install through npm as such: npm install rtlcss-stylus

Usage

You can include rtlcss-stylus as a normal stylus plugin. Full example creating two different stylesheets (ltr and rtl) at every pass below:

    function compile(rtl, str, path) {

        var compile = stylus(
            str
        );

        if (rtl) compile = compile.use(rtlcss());

        return compile;

    }

    app.use(
        stylus.middleware(
            {
                src: path.join(__dirname, 'public'),
                dest: path.join(__dirname, 'public'),
                compile: compile.bind(this, false)
            }
        )
    );

    app.use(
        stylus.middleware(
            {
                src: path.join(__dirname, 'public'),
                dest: function(cssPath){

                    return path.join(__dirname, 'public',cssPath).replace('style.css', 'style-rtl.css');

                },
                compile: compile.bind(this, true)
            }
        )
    );

Currently only has a basic test which you can run via npm test.

In production I only tested it with inline rtlcss directives, i.e. without providing any special options via the middleware.