raptor-optimizer-stylus

1.0.2-beta • Public • Published

raptor-optimizer-stylus

This plugin for the RaptorJS Optimizer provides support for rendering Stylus dependencies to CSS.

Installation

First install the plugin:

npm install raptor-optimizer-stylus --save

Then, enable the plugin when configuring the RaptorJS Optimizer:

require('raptor-optimizer').configure({
        plugins: [
            {
                module: 'raptor-optimizer-stylus',
                config: {
                    ... // See Configuration below
                }
            }
        ]
    });

Usage

Once this plugin has been enabled, you can then add Stylus dependencies to your optimizer.json files. The file extension for Stylus files is expected to be .styl. Example:

optimizer.json:

{
    "dependencies": [
        "style.styl"
    ]
}

Configuration

The configuration for the raptor-optimizer-stylus plugin supports the following properties:

Example configuration:

require('raptor-optimizer').configure({
        plugins: [
            {
                module: 'raptor-optimizer-stylus',
                config: {
                    includes: [nodePath.join(__dirname, 'stylus/mixins/')],
                    use: function(stylus) {
                        stylus.define('add', function(a, b) {
                            a = parseFloat(a);
                            b = parseFloat(b);
                            return a+b;
                        });
                    },
                    define: {
                        sub: function(a, b) {
                            a = parseFloat(a);
                            b = parseFloat(b);
                            return a-b;
                        }
                    },
                    imports: [
                        nodePath.join(__dirname, 'stylus/variables.styl')
                    ]
                }
            }
        ]
    });

Package Sidebar

Install

npm i raptor-optimizer-stylus

Weekly Downloads

4

Version

1.0.2-beta

License

Apache License v2.0

Last publish

Collaborators

  • austinkelleher
  • dylanpiercey
  • pnidem