Commit 2d0ba61c by Gong Hao

add sass include_paths and output_style args

parent 5d331102
......@@ -51,8 +51,8 @@ Handle<Value> Render(const Arguments& args) {
ctx->source_string = new char[strlen(*astr)+1];
strcpy(ctx->source_string, *astr);
ctx->options.include_paths = 0;
ctx->options.output_style = SASS_STYLE_NESTED;
ctx->options.include_paths = args[2];
ctx->options.output_style = args[3];
ctx->callback = Persistent<Function>::New(callback);
ctx->request.data = ctx;
......
......@@ -13,6 +13,22 @@ try {
if (binding === null) {
throw new Error('Cannot find appropriate binary library for node-sass');
}
exports.render = binding.render
var toString = Object.prototype.toString;
SASS_OUTPUT_STYLE = {
nested: 0,
expanded: 1,
compact: 2,
compressed: 3
};
exports.render = function(css, callback, options) {
var paths, style;
if (toString.call(options) !== '[object Object]') {
options = {};
}
paths = options.include_paths || [];
if (!((style = options.output_style) in SASS_OUTPUT_STYLE)) {
style = 'nested';
}
return binding.render(css, callback, paths.join(':'), SASS_OUTPUT_STYLE[style]);
};
exports.middleware = require('./lib/middleware');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment