Sha256: 41c52547c197fd8c4a5e6c099daf30965d100a94d931243eb556ae48a7c93f86

Contents?: true

Size: 744 Bytes

Versions: 4

Compression:

Stored size: 744 Bytes

Contents

var stylus = require('stylus');

function compile(str, options, plugins, imports, definitions) {
  var style = stylus(str, options);
  var output = '';

  for(var name in plugins) {
    var fn = require(name);
    style.use(fn(plugins[name]));
  }

  imports.forEach(function(path) {
    style.import(path);
  })

  for(var definition in definitions) {
    obj = definitions[definition];
    value = obj.value

    if(obj.literal) {
      value = new stylus.nodes.Literal(value);
    }

    style.define(definition, value);
  }

  style.render(function(error, css) {
    if(error) throw error;
    output = css;
  })
  return output;
}

function convert(str) {
  return stylus.convertCSS(str);
}

function version() {
  return stylus.version;
}

Version data entries

4 entries across 4 versions & 3 rubygems

Version Path
nov-stylus-1.0.3 lib/stylus/runtime/compiler.js
nov-stylus-1.0.2 lib/stylus/runtime/compiler.js
stylus-1.0.2 lib/stylus/runtime/compiler.js
epuber-stylus-1.1.0 lib/epuber-stylus/runtime/compiler.js