node-sass
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -5,3 +5,3 @@ { | ||
"description": "wrapper around libsass", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"homepage": "https://github.com/andrew/node-sass", | ||
@@ -8,0 +8,0 @@ "keywords": ["sass", "css", "libsass"], |
@@ -20,5 +20,7 @@ ##node-sass | ||
sass.render(scss_content, callback [, options]); | ||
// OR | ||
var css = sass.renderSync(scss_content); | ||
``` | ||
Especially, the options argument is optional. It support two attribute: `includePaths` and `outputStyle`, both of them are optional. | ||
Especially, the options argument is optional. It support two attributes: `includePaths` and `outputStyle`, both of which are optional. | ||
@@ -37,2 +39,4 @@ `includePaths` is an `Array`, you can add a sass import path. | ||
}/*, { includePaths: [ 'lib/', 'mod/' ], outputStyle: 'compressed' }*/); | ||
// OR | ||
console.log(sass.renderSync('body{background:blue; a{color:black;}}')); | ||
``` | ||
@@ -39,0 +43,0 @@ |
@@ -32,2 +32,10 @@ var binding; | ||
exports.renderSync = function(css, options) { | ||
var paths, style; | ||
options = typeof options !== 'object' ? {} : options; | ||
paths = options.include_paths || options.includePaths || []; | ||
style = SASS_OUTPUT_STYLE[options.output_style || options.outputStyle] || 0; | ||
return binding.renderSync(css, paths.join(':'), style); | ||
}; | ||
exports.middleware = require('./lib/middleware'); |
@@ -15,2 +15,6 @@ var sass = require('../sass'); | ||
// Note that the bad | ||
var badInput = '#navbar \n\ | ||
width: 80%'; | ||
var expectedRender = '#navbar {\n\ | ||
@@ -30,3 +34,3 @@ width: 80%;\n\ | ||
describe("compile scss", function() { | ||
it("should compile", function(done) { | ||
it("should compile with render", function(done) { | ||
sass.render(scssStr, function(err, css) { | ||
@@ -37,3 +41,7 @@ done(err); | ||
it("should match compiled string", function(done) { | ||
it("should compile with renderSync", function(done) { | ||
done(assert.ok(sass.renderSync(scssStr))); | ||
}); | ||
it("should match compiled string with render", function(done) { | ||
sass.render(scssStr, function(err, css) { | ||
@@ -47,2 +55,12 @@ if (!err) { | ||
}); | ||
}); | ||
it("should match compiled string with renderSync", function(done) { | ||
done(assert.equal(sass.renderSync(scssStr), expectedRender)); | ||
}); | ||
it("should throw an exception for bad input", function(done) { | ||
done(assert.throws(function() { | ||
sass.renderSync(badInput); | ||
})); | ||
}); | ||
}); |
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
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
5656833
88
295
95