Commit ed5b5dc3 by Andrew Nesbitt

Merge pull request #67 from sindresorhus/camel-case

Convert the options to camelCase. Fixes #43
parents ece89940 0a56158c
......@@ -19,12 +19,12 @@ var sass = require('node-sass');
sass.render(scss_content, callback [, options]);
```
Especially, the options argument is optional. It support two attribute: `include_paths` and `output_style`, both of them are optional.
Especially, the options argument is optional. It support two attribute: `includePaths` and `outputStyle`, both of them are optional.
`include_paths` is an `Array`, you can add a sass import path.
`includePaths` is an `Array`, you can add a sass import path.
`output_style` is a `String`, its value should be one of `'nested', 'expanded', 'compact', 'compressed'`.
[Important: currently the argument `output_style` has some problem which may cause the output css becomes nothing because of the libsass, so you should not use it now!]
`outputStyle` is a `String`, its value should be one of `'nested', 'expanded', 'compact', 'compressed'`.
[Important: currently the argument `outputStyle` has some problem which may cause the output css becomes nothing because of the libsass, so you should not use it now!]
Here is an example:
......@@ -32,7 +32,7 @@ Here is an example:
var sass = require('node-sass');
sass.render('body{background:blue; a{color:black;}}', function(err, css){
console.log(css)
}/*, { include_paths: [ 'lib/', 'mod/' ], output_style: 'compressed' }*/);
}/*, { includePaths: [ 'lib/', 'mod/' ], outputStyle: 'compressed' }*/);
```
## Connect/Express middleware
......
......@@ -13,20 +13,20 @@ try {
if (binding === null) {
throw new Error('Cannot find appropriate binary library for node-sass');
}
var toString = Object.prototype.toString;
SASS_OUTPUT_STYLE = {
var SASS_OUTPUT_STYLE = {
nested: 0,
expanded: 1,
compact: 2,
compressed: 3
};
exports.render = function(css, callback, options) {
var paths, style;
typeof options != "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]);
options = typeof options !== 'object' ? {} : options;
paths = options.include_paths || options.includePaths || [];
style = SASS_OUTPUT_STYLE[options.output_style || options.outputStyle] || 0;
return binding.render(css, callback, paths.join(':'), 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