Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including metalsmith-stylus with all npm packages installed. Try it out:

var metalsmithStylus = require("metalsmith-stylus")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

metalsmith-stylus v3.0.0

metalsmith stylus plugin

metalsmith-stylus

Build Status Dependency Status

A Stylus plugin for Metalsmith.

Installation

npm install --save metalsmith-stylus

Getting Started

If you haven't checked out Metalsmith before, head over to their website and check out the documentation.

CLI Usage

If you are using the command-line version of Metalsmith, you can install via npm, and then add the metalsmith-stylus key to your metalsmith.json file:

{
  "plugins": {
    "metalsmith-stylus": {}
  }
}

JavaScript API

If you are using the JS Api for Metalsmith, then you can require the module and add it to your .use() directives:

var stylus = require('metalsmith-stylus');

metalsmith.use(stylus());

Options

All option keys will be passed to stylus' set method, except define and use.

To use stylus plug-ins like nib or autoprefixer, add them as array to use:

var stylus = require('metalsmith-stylus');
var nib = require('nib');

metalsmith.use(stylus({
    // Set stylus output to compressed
    compress: true,
    // Use the 'nib' plug-in
    use: [nib()],
    // Inline images as base64
    define: {
        url: stylus.url()
    }
}));
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free