node-sass
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -5,3 +5,3 @@ { | ||
"description": "wrapper around libsass", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"homepage": "https://github.com/andrew/node-sass", | ||
@@ -31,7 +31,8 @@ "keywords": ["sass", "css", "libsass"], | ||
"engines": { | ||
"node": ">=0.6.18" | ||
"node": ">=0.10.0" | ||
}, | ||
"dependencies": { | ||
"mkdirp": "0.3.x", | ||
"colors": "0.6.0-1" | ||
"colors": "0.6.0-1", | ||
"optimist": "0.3.x" | ||
}, | ||
@@ -38,0 +39,0 @@ "devDependencies": { |
@@ -17,18 +17,22 @@ ##node-sass | ||
var sass = require('node-sass'); | ||
sass.render(scss_content, callback [, options]); | ||
```javascript | ||
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: | ||
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' }*/); | ||
```javascript | ||
var sass = require('node-sass'); | ||
sass.render('body{background:blue; a{color:black;}}', function(err, css){ | ||
console.log(css) | ||
}/*, { includePaths: [ 'lib/', 'mod/' ], outputStyle: 'compressed' }*/); | ||
``` | ||
@@ -39,13 +43,33 @@ ## Connect/Express middleware | ||
var server = connect.createServer( | ||
sass.middleware({ | ||
src: __dirname | ||
, dest: __dirname + '/public' | ||
, debug: true | ||
}), | ||
connect.static(__dirname + '/public') | ||
); | ||
```javascript | ||
var server = connect.createServer( | ||
sass.middleware({ | ||
src: __dirname | ||
, dest: __dirname + '/public' | ||
, debug: true | ||
}), | ||
connect.static(__dirname + '/public') | ||
); | ||
``` | ||
Heavily inspired by <https://github.com/LearnBoost/stylus> | ||
## Rebuilding binaries | ||
Node-sass includes pre-compiled binaries for popular platforms, to add a binary for your platform follow these steps: | ||
Check out the project: | ||
git clone https://github.com/andrew/node-sass.git | ||
cd node-sass | ||
npm install | ||
git submodule init | ||
git submodule update | ||
node-gyp rebuild | ||
Replace the prebuild binary with your newly generated one | ||
cp build/Release/binding.node precompiled/*your-platform*/binding.node | ||
## TODO | ||
@@ -52,0 +76,0 @@ |
16
sass.js
@@ -16,4 +16,4 @@ var binding; | ||
} | ||
var toString = Object.prototype.toString; | ||
SASS_OUTPUT_STYLE = { | ||
var SASS_OUTPUT_STYLE = { | ||
nested: 0, | ||
@@ -24,11 +24,11 @@ expanded: 1, | ||
}; | ||
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'); |
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
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
5613461
85
90
3
271
+ Addedoptimist@0.3.x
+ Addedoptimist@0.3.7(transitive)
+ Addedwordwrap@0.0.3(transitive)