node-sass
Advanced tools
Comparing version 0.2.4 to 0.2.5
@@ -5,3 +5,3 @@ { | ||
"description": "wrapper around libsass", | ||
"version": "0.2.4", | ||
"version": "0.2.5", | ||
"homepage": "http://github.com/andrew/node-sass", | ||
@@ -8,0 +8,0 @@ "main": "./sass.js", |
@@ -16,5 +16,17 @@ ##node-sass | ||
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. | ||
`include_paths` 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!] | ||
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' }*/); | ||
@@ -21,0 +33,0 @@ ## Connect/Express middleware |
20
sass.js
@@ -16,4 +16,20 @@ var binding; | ||
} | ||
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'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
4224197
71
235
53
1
3