Skip to content

shaharyakir/rtlcss-stylus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

rtlcss stylus wrapper

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published