node-sass
Advanced tools
Comparing version 0.7.0 to 0.8.0
146
build.js
#!/usr/bin/env node | ||
var cp = require('child_process'), | ||
fs = require('fs'), | ||
path = require('path'), | ||
Mocha = require('mocha'); | ||
fs = require('fs'), | ||
path = require('path'), | ||
Mocha = require('mocha'); | ||
@@ -11,19 +11,19 @@ // Parse args | ||
var arch = process.arch, | ||
platform = process.platform, | ||
v8 = /[0-9]+\.[0-9]+/.exec(process.versions.v8)[0]; | ||
platform = process.platform, | ||
v8 = /[0-9]+\.[0-9]+/.exec(process.versions.v8)[0]; | ||
var args = process.argv.slice(2).filter(function(arg) { | ||
if (arg === '-f') { | ||
force = true; | ||
return false; | ||
} else if (arg.substring(0, 13) === '--target_arch') { | ||
arch = arg.substring(14); | ||
} else if (arg === '--debug') { | ||
debug = true; | ||
} | ||
return true; | ||
if (arg === '-f') { | ||
force = true; | ||
return false; | ||
} else if (arg.substring(0, 13) === '--target_arch') { | ||
arch = arg.substring(14); | ||
} else if (arg === '--debug') { | ||
debug = true; | ||
} | ||
return true; | ||
}); | ||
if (!{ia32: true, x64: true, arm: true}.hasOwnProperty(arch)) { | ||
console.error('Unsupported (?) architecture: `'+ arch+ '`'); | ||
process.exit(1); | ||
console.error('Unsupported (?) architecture: `'+ arch+ '`'); | ||
process.exit(1); | ||
} | ||
@@ -33,30 +33,30 @@ | ||
var modPath = platform + '-' + arch + '-v8-' + v8; | ||
if (!force) { | ||
try { | ||
fs.statSync(path.join(__dirname, 'bin', modPath, 'binding.node')); | ||
console.log('`'+ modPath+ '` exists; testing'); | ||
var mocha = new Mocha({ | ||
reporter: 'min', | ||
ui: 'bdd', | ||
timeout: 999999 | ||
}); | ||
mocha.addFile(path.resolve(__dirname, "test", "test.js")); | ||
if (!force && !process.env.SKIP_NODE_SASS_TESTS) { | ||
try { | ||
fs.statSync(path.join(__dirname, 'bin', modPath, 'binding.node')); | ||
console.log('`'+ modPath+ '` exists; testing'); | ||
var runner = mocha.run(function (done) { | ||
if (done !== 0) { | ||
console.log('Problem with the binary; manual build incoming'); | ||
console.log('Please consider contributing the release binary to https://github.com/andrew/node-sass-binaries for npm distribution.'); | ||
build(); | ||
} else { | ||
console.log('Binary is fine; exiting'); | ||
} | ||
}); | ||
} catch (ex) { | ||
// Stat failed | ||
build(); | ||
} | ||
var mocha = new Mocha({ | ||
reporter: 'dot', | ||
ui: 'bdd', | ||
timeout: 999999 | ||
}); | ||
mocha.addFile(path.resolve(__dirname, "test", "test.js")); | ||
mocha.run(function (done) { | ||
if (done !== 0) { | ||
console.log('Problem with the binary; manual build incoming'); | ||
console.log('Please consider contributing the release binary to https://github.com/andrew/node-sass-binaries for npm distribution.'); | ||
build(); | ||
} else { | ||
console.log('Binary is fine; exiting'); | ||
} | ||
}); | ||
} catch (ex) { | ||
// Stat failed | ||
build(); | ||
} | ||
} else { | ||
build(); | ||
build(); | ||
} | ||
@@ -66,20 +66,20 @@ | ||
function build() { | ||
cp.spawn( | ||
process.platform === 'win32' ? 'node-gyp.cmd' : 'node-gyp', | ||
['rebuild'].concat(args), | ||
{customFds: [0, 1, 2]}) | ||
.on('exit', function(err) { | ||
if (err) { | ||
if (err === 127) { | ||
console.error( | ||
'node-gyp not found! Please upgrade your install of npm! You need at least 1.1.5 (I think) '+ | ||
'and preferably 1.1.30.' | ||
); | ||
} else { | ||
console.error('Build failed'); | ||
} | ||
return process.exit(err); | ||
} | ||
afterBuild(); | ||
}); | ||
cp.spawn( | ||
process.platform === 'win32' ? 'node-gyp.cmd' : 'node-gyp', | ||
['rebuild'].concat(args), | ||
{customFds: [0, 1, 2]}) | ||
.on('exit', function(err) { | ||
if (err) { | ||
if (err === 127) { | ||
console.error( | ||
'node-gyp not found! Please upgrade your install of npm! You need at least 1.1.5 (I think) '+ | ||
'and preferably 1.1.30.' | ||
); | ||
} else { | ||
console.error('Build failed'); | ||
} | ||
return process.exit(err); | ||
} | ||
afterBuild(); | ||
}); | ||
} | ||
@@ -89,17 +89,17 @@ | ||
function afterBuild() { | ||
var targetPath = path.join(__dirname, 'build', debug ? 'Debug' : 'Release', 'binding.node'); | ||
var installPath = path.join(__dirname, 'bin', modPath, 'binding.node'); | ||
var targetPath = path.join(__dirname, 'build', debug ? 'Debug' : 'Release', 'binding.node'); | ||
var installPath = path.join(__dirname, 'bin', modPath, 'binding.node'); | ||
try { | ||
fs.mkdirSync(path.join(__dirname, 'bin', modPath)); | ||
} catch (ex) {} | ||
try { | ||
fs.mkdirSync(path.join(__dirname, 'bin', modPath)); | ||
} catch (ex) {} | ||
try { | ||
fs.statSync(targetPath); | ||
} catch (ex) { | ||
console.error('Build succeeded but target not found'); | ||
process.exit(1); | ||
} | ||
fs.renameSync(targetPath, installPath); | ||
console.log('Installed in `'+ installPath+ '`'); | ||
try { | ||
fs.statSync(targetPath); | ||
} catch (ex) { | ||
console.error('Build succeeded but target not found'); | ||
process.exit(1); | ||
} | ||
fs.renameSync(targetPath, installPath); | ||
console.log('Installed in `'+ installPath+ '`'); | ||
} |
@@ -6,4 +6,4 @@ | ||
var connect = require('connect') | ||
, sass = require('../sass'); | ||
var connect = require('connect'), | ||
sass = require('../sass'); | ||
@@ -15,6 +15,6 @@ // Setup server | ||
sass.middleware({ | ||
src: __dirname | ||
, dest: __dirname + '/public' | ||
, debug: true | ||
, outputStyle: 'compressed' | ||
src: __dirname, | ||
dest: __dirname + '/public', | ||
debug: true, | ||
outputStyle: 'compressed' | ||
}), | ||
@@ -25,2 +25,2 @@ connect.static(__dirname + '/public') | ||
server.listen(3000); | ||
console.log('server listening on port 3000'); | ||
console.log('server listening on port 3000'); |
@@ -17,2 +17,5 @@ var watch = require('node-watch'), | ||
}) | ||
.options('source-map', { | ||
describe: 'Emit source map' | ||
}) | ||
.options('include-path', { | ||
@@ -39,4 +42,4 @@ describe: 'Path to look for @import-ed files', | ||
.check(function(argv){ | ||
if (argv.help) return true; | ||
if (argv._.length < 1) return false; | ||
if (argv.help) { return true; } | ||
if (argv._.length < 1) { return false; } | ||
}); | ||
@@ -73,3 +76,6 @@ | ||
emitter.on('error', function(){}); | ||
emitter.on('error', function(err){ | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
@@ -84,3 +90,7 @@ var options = { | ||
if (!outFile) { | ||
outFile = options.outFile = path.join(cwd, path.basename(inFile, '.scss') + '.css'); | ||
var suffix = '.css'; | ||
if (/\.css$/.test(inFile)) { | ||
suffix = ''; | ||
} | ||
outFile = options.outFile = path.join(cwd, path.basename(inFile, '.scss') + suffix); | ||
} | ||
@@ -106,2 +116,12 @@ | ||
// set source map file and set sourceComments to 'map' | ||
if (argv['source-map']) { | ||
options.sourceComments = 'map'; | ||
if (argv['source-map'] === true) { | ||
options.sourceMap = outFile + '.map'; | ||
} else { | ||
options.sourceMap = path.resolve(cwd, argv['source-map']); | ||
} | ||
} | ||
if (argv.w) { | ||
@@ -108,0 +128,0 @@ |
@@ -1,8 +0,7 @@ | ||
var sass = require('../sass') | ||
, fs = require('fs') | ||
, url = require('url') | ||
, basename = require('path').basename | ||
, dirname = require('path').dirname | ||
, mkdirp = require('mkdirp') | ||
, join = require('path').join; | ||
var sass = require('../sass'), | ||
fs = require('fs'), | ||
url = require('url'), | ||
dirname = require('path').dirname, | ||
mkdirp = require('mkdirp'), | ||
join = require('path').join; | ||
@@ -60,3 +59,3 @@ var imports = {}; | ||
var src = options.src; | ||
if (!src) throw new Error('sass.middleware() requires "src" directory'); | ||
if (!src) { throw new Error('sass.middleware() requires "src" directory'); } | ||
@@ -72,3 +71,3 @@ // Default dest dir to source | ||
options.compile = options.compile || function(){ | ||
return sass | ||
return sass; | ||
}; | ||
@@ -78,3 +77,3 @@ | ||
return function sass(req, res, next){ | ||
if ('GET' != req.method && 'HEAD' != req.method) return next(); | ||
if ('GET' != req.method && 'HEAD' != req.method) { return next(); } | ||
var path = url.parse(req.url).pathname; | ||
@@ -85,5 +84,5 @@ if (options.prefix && 0 === path.indexOf(options.prefix)) { | ||
if (/\.css$/.test(path)) { | ||
var cssPath = join(dest, path) | ||
, sassPath = join(src, path.replace('.css', '.scss')) | ||
, sassDir = dirname(sassPath); | ||
var cssPath = join(dest, path), | ||
sassPath = join(src, path.replace('.css', '.scss')), | ||
sassDir = dirname(sassPath); | ||
@@ -104,16 +103,16 @@ if (root) { | ||
// Ignore ENOENT to fall through as 404 | ||
function error(err) { | ||
var error = function(err) { | ||
next('ENOENT' == err.code | ||
? null | ||
: err); | ||
} | ||
}; | ||
// Force | ||
if (force) return compile(); | ||
if (force) { return compile(); } | ||
// Compile to cssPath | ||
function compile() { | ||
if (debug) log('read', cssPath); | ||
var compile = function() { | ||
if (debug) { log('read', cssPath); } | ||
fs.readFile(sassPath, 'utf8', function(err, str){ | ||
if (err) return error(err); | ||
if (err) { return error(err); } | ||
var style = options.compile(); | ||
@@ -123,7 +122,7 @@ var paths = []; | ||
style.render(str, function(err, css){ | ||
if (err) return next(err); | ||
if (debug) log('render', sassPath); | ||
if (err) { return next(err); } | ||
if (debug) { log('render', sassPath); } | ||
imports[sassPath] = paths; | ||
mkdirp(dirname(cssPath), 0700, function(err){ | ||
if (err) return error(err); | ||
if (err) { return error(err); } | ||
fs.writeFile(cssPath, css, 'utf8', next); | ||
@@ -136,11 +135,11 @@ }); | ||
}); | ||
} | ||
}; | ||
// Re-compile on server restart, disregarding | ||
// mtimes since we need to map imports | ||
if (!imports[sassPath]) return compile(); | ||
if (!imports[sassPath]) { return compile(); } | ||
// Compare mtimes | ||
fs.stat(sassPath, function(err, sassStats){ | ||
if (err) return error(err); | ||
if (err) { return error(err); } | ||
fs.stat(cssPath, function(err, cssStats){ | ||
@@ -150,3 +149,3 @@ // CSS has not been compiled, compile it! | ||
if ('ENOENT' == err.code) { | ||
if (debug) log('not found', cssPath); | ||
if (debug) { log('not found', cssPath); } | ||
compile(); | ||
@@ -159,3 +158,3 @@ } else { | ||
if (sassStats.mtime > cssStats.mtime) { | ||
if (debug) log('modified', cssPath); | ||
if (debug) { log('modified', cssPath); } | ||
compile(); | ||
@@ -179,3 +178,3 @@ // Already compiled, check imports | ||
} | ||
} | ||
}; | ||
}; | ||
@@ -193,7 +192,7 @@ | ||
var nodes = imports[path]; | ||
if (!nodes) return fn(); | ||
if (!nodes.length) return fn(); | ||
if (!nodes) { return fn(); } | ||
if (!nodes.length) { return fn(); } | ||
var pending = nodes.length | ||
, changed = []; | ||
var pending = nodes.length, | ||
changed = []; | ||
@@ -200,0 +199,0 @@ nodes.forEach(function(imported){ |
@@ -1,8 +0,5 @@ | ||
var sass = require('../sass'), | ||
colors = require('colors'), | ||
chalk = require('chalk'), | ||
fs = require('fs'); | ||
var cwd = process.cwd(); | ||
function render(options, emitter) { | ||
@@ -15,12 +12,31 @@ | ||
sourceComments: options.sourceComments, | ||
success: function(css) { | ||
sourceMap: options.sourceMap, | ||
success: function(css, sourceMap) { | ||
emitter.emit('warn', 'Rendering Complete, saving .css file...'.green); | ||
var todo = 1; | ||
var done = function() { | ||
if (--todo <= 0) { | ||
emitter.emit('done'); | ||
} | ||
}; | ||
emitter.emit('warn', chalk.green('Rendering Complete, saving .css file...')); | ||
fs.writeFile(options.outFile, css, function(err) { | ||
if (err) return emitter.emit('error', ('Error: ' + err).red); | ||
emitter.emit('warn', ('Wrote CSS to ' + options.outFile).green); | ||
if (err) { return emitter.emit('error', chalk.red('Error: ' + err)); } | ||
emitter.emit('warn', chalk.green('Wrote CSS to ' + options.outFile)); | ||
emitter.emit('write', err, options.outFile, css); | ||
done(); | ||
}); | ||
if (options.sourceMap) { | ||
todo++; | ||
fs.writeFile(options.sourceMap, sourceMap, function(err) { | ||
if (err) {return emitter.emit('error', chalk.red('Error' + err)); } | ||
emitter.emit('warn', chalk.green('Wrote Source Map to ' + options.sourceMap)); | ||
emitter.emit('write-source-map', err, options.sourceMap, sourceMap); | ||
done(); | ||
}); | ||
} | ||
if (options.stdout) { | ||
@@ -33,3 +49,3 @@ emitter.emit('log', css); | ||
error: function(error) { | ||
emitter.emit('error', error); | ||
emitter.emit('error', chalk.red(error)); | ||
} | ||
@@ -36,0 +52,0 @@ }); |
@@ -6,3 +6,3 @@ Libsass | ||
[![Build Status](https://secure.travis-ci.org/hcatlin/sassc.png?branch=master)](http://travis-ci.org/hcatlin/sassc) | ||
[![Build Status](https://travis-ci.org/hcatlin/libsass.png?branch=master)](https://travis-ci.org/hcatlin/libsass) | ||
@@ -37,2 +37,17 @@ http://github.com/hcatlin/libsass | ||
Tests | ||
------- | ||
Since libsass is a pure library, tests are run through the [SassSpec](http://github.com/hcatlin/sass-spec) project using the [SassC](http://github.com/hcatlin/sassc) driver. | ||
To run tests against libsass while developing, please ensure you have the latest version of the above projects cloned, and then define the following environment variables: | ||
export SASS_SPEC_PATH=~/path/sass-spec | ||
export SASS_SASSC_PATH=~/path/sassc | ||
export SASS_LIBSASS_PATH=~/path/libsass | ||
Obviously, update them to your local environment. Then, its just a matter of running... | ||
make test | ||
Usage | ||
@@ -42,3 +57,3 @@ ----- | ||
While libsass is primarily implemented in C++, it provides a simple | ||
C interface that is defined in [sass_inteface.h]. Its usage is pretty | ||
C interface that is defined in [sass_interface.h]. Its usage is pretty | ||
straight forward. | ||
@@ -54,3 +69,3 @@ | ||
Each of the context's have slightly different behavior and are | ||
Each of the contexts have slightly different behavior and are | ||
implemented seperately. This does add extra work to implementing | ||
@@ -95,6 +110,9 @@ a wrapper library, but we felt that a mixed-use context object | ||
Any contribution to the project are seen as copyright assigned to Hampton Catlin. Your contribution warrants that you have the right to assign copyright on your work. This is to ensure that the project remains free and open -- similar to the Apache Foundation. | ||
Any contribution to the project are seen as copyright assigned to Hampton Catlin, a | ||
human on the planet earth. Your contribution warrants that you have the right to | ||
assign copyright on your work. The intention here is to ensure that the project | ||
remains totally free (liberal, like). | ||
Our license is designed to be as simple as possible. | ||
Our MIT license is designed to be as simple, and liberal as possible. | ||
@@ -5,3 +5,3 @@ { | ||
"description": "wrapper around libsass", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"homepage": "https://github.com/andrew/node-sass", | ||
@@ -30,2 +30,3 @@ "keywords": [ | ||
"test": "mocha test", | ||
"pretest": "jshint .", | ||
"prepublish": "bash scripts/prepublish.sh" | ||
@@ -42,7 +43,11 @@ }, | ||
"mkdirp": "0.3.x", | ||
"colors": "0.6.0-1", | ||
"optimist": "0.6.x", | ||
"node-watch": "0.3.x", | ||
"mocha": "1.13.x" | ||
"mocha": "1.13.x", | ||
"chalk": "~0.3.0", | ||
"nan": "~0.6.0" | ||
}, | ||
"devDependencies": { | ||
"jshint": "~2.4.0" | ||
} | ||
} |
@@ -55,3 +55,3 @@ ##node-sass | ||
#### sourceComments | ||
`sourceComments` is a `String` to determine what debug information is included in the output file. Its value should be one of `'none', 'normal', 'map'`. The default is `'none'`. | ||
`sourceComments` is a `String` to determine what debug information is included in the output file. Its value should be one of `'none', 'normal'`. The default is `'none'`. | ||
[Important: `souceComments` is only supported when using the `file` option, and does nothing when using `data` flag.] | ||
@@ -112,2 +112,10 @@ | ||
## Gulp extension | ||
[@dlmanning](https://github.com/dlmanning/) has created a gulp sass plugin based on node-sass: <https://github.com/dlmanning/gulp-sass> | ||
## Harp | ||
[@sintaxi](https://github.com/sintaxi)’s Harp web server implicitly compiles `.scss` files using node-sass: <https://github.com/sintaxi/harp> | ||
## Example App | ||
@@ -125,6 +133,6 @@ | ||
cd node-sass | ||
git submodule init | ||
git submodule update | ||
npm install | ||
npm install -g node-gyp | ||
git submodule init | ||
git submodule update | ||
node-gyp rebuild | ||
@@ -152,2 +160,10 @@ | ||
## Post-install Build | ||
Install runs a series of Mocha tests to see if your machine can use the pre-built `libsass` which will save some time during install. If any tests fail it will build from source. | ||
If you know the pre-built version will work and do not want to wait for the tests to run you can skip the tests by setting the environment variable `SKIP_NODE_SASS_TESTS` to true. | ||
SKIP_NODE_SASS_TESTS=true npm install | ||
## Contributors | ||
@@ -160,2 +176,3 @@ Special thanks to the following people for submitting patches: | ||
gonghao | ||
Dylan Greene | ||
@@ -162,0 +179,0 @@ ### Note on Patches/Pull Requests |
36
sass.js
@@ -27,17 +27,17 @@ var binding; | ||
compressed: 3 | ||
}; | ||
}; | ||
var SASS_SOURCE_COMMENTS = { | ||
none: 0, | ||
// This is called default in libsass, but is a reserved keyword here | ||
normal: 1, | ||
map: 2 | ||
}; | ||
none: 0, | ||
// This is called default in libsass, but is a reserved keyword here | ||
normal: 1, | ||
map: 2 | ||
}; | ||
var prepareOptions = function(options) { | ||
var paths, style; | ||
var options = typeof options !== 'object' ? {} : options; | ||
var paths = options.include_paths || options.includePaths || []; | ||
var style = SASS_OUTPUT_STYLE[options.output_style || options.outputStyle] || 0; | ||
var comments = SASS_SOURCE_COMMENTS[options.source_comments || options.sourceComments] || 0; | ||
var paths, style, comments; | ||
options = typeof options !== 'object' ? {} : options; | ||
paths = options.include_paths || options.includePaths || []; | ||
style = SASS_OUTPUT_STYLE[options.output_style || options.outputStyle] || 0; | ||
comments = SASS_SOURCE_COMMENTS[options.source_comments || options.sourceComments] || 0; | ||
@@ -53,3 +53,9 @@ return { | ||
options = prepareOptions(options); | ||
return binding.oldRender(css, callback, options.paths.join(':'), options.style, options.comments); | ||
var errCallback = function(err) { | ||
callback(err); | ||
}; | ||
var oldCallback = function(css) { | ||
callback(null, css); | ||
}; | ||
return binding.render(css, oldCallback, errCallback, options.paths.join(':'), options.style, options.comments); | ||
}; | ||
@@ -73,3 +79,3 @@ | ||
if (options.file !== undefined && options.file !== null) { | ||
return binding.renderFile(options.file, options.success, options.error, newOptions.paths.join(path.delimiter), newOptions.style, newOptions.comments); | ||
return binding.renderFile(options.file, options.success, options.error, newOptions.paths.join(path.delimiter), newOptions.style, newOptions.comments, options.sourceMap); | ||
} | ||
@@ -91,9 +97,9 @@ | ||
if (options.file !== undefined && options.file !== null) { | ||
return binding.renderFileSync(options.file, newOptions.paths.join(':'), newOptions.style, newOptions.comments); | ||
return binding.renderFileSync(options.file, newOptions.paths.join(path.delimiter), newOptions.style, newOptions.comments); | ||
} | ||
//Assume data is present if file is not. binding/libsass will tell the user otherwise! | ||
return binding.renderSync(options.data, newOptions.paths.join(":"), newOptions.style); | ||
return binding.renderSync(options.data, newOptions.paths.join(path.delimiter), newOptions.style); | ||
}; | ||
exports.middleware = require('./lib/middleware'); |
@@ -5,3 +5,2 @@ var path = require('path'), | ||
exec = require('child_process').exec, | ||
sass = require('../sass'), | ||
cli = require('../lib/cli'), | ||
@@ -41,3 +40,3 @@ | ||
cwd: __dirname | ||
}, function(err, stdout, stderr) { | ||
}, function() { | ||
@@ -51,3 +50,3 @@ fs.exists(resultPath, function(exists) { | ||
it('should compile sample.scss to ../out.css', function(done) { | ||
it('should compile sample.scss to ../out.css', function(done) { | ||
var resultPath = path.resolve(__dirname, '../out.css'); | ||
@@ -57,3 +56,3 @@ | ||
cwd: __dirname | ||
}, function(err, stdout, stderr) { | ||
}, function() { | ||
@@ -75,3 +74,3 @@ fs.exists(resultPath, function(exists) { | ||
emitter.on('write', function(err, file, css){ | ||
assert.equal(css.trim(), 'body {\n background: red;\n color: blue; }'); | ||
assert.equal(css.trim(), 'body {\n background: red;\n color: #0000fe; }'); | ||
fs.unlink(file, done); | ||
@@ -103,3 +102,3 @@ }); | ||
emitter.on('error', done); | ||
emitter.on('write', function(err, file, css){ | ||
emitter.on('write', function(){ | ||
fs.exists(resultPath, function(exists) { | ||
@@ -112,2 +111,38 @@ assert(exists); | ||
it('should compile with the --source-map option', function(done){ | ||
var emitter = cli([path.join(__dirname, 'sample.scss'), '--source-map']); | ||
emitter.on('error', done); | ||
emitter.on('write-source-map', function(err, file) { | ||
assert.equal(file, path.join(__dirname, '../sample.css.map')); | ||
fs.exists(file, function(exists) { | ||
assert(exists); | ||
}); | ||
}); | ||
emitter.on('done', function() { | ||
fs.unlink(path.join(__dirname, '../sample.css.map'), function() { | ||
fs.unlink(path.join(__dirname, '../sample.css'), function() { | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
it('should compile with the --source-map option with specific filename', function(done){ | ||
var emitter = cli([path.join(__dirname, 'sample.scss'), '--source-map', path.join(__dirname, '../sample.map')]); | ||
emitter.on('error', done); | ||
emitter.on('write-source-map', function(err, file) { | ||
assert.equal(file, path.join(__dirname, '../sample.map')); | ||
fs.exists(file, function(exists) { | ||
assert(exists); | ||
}); | ||
}); | ||
emitter.on('done', function() { | ||
fs.unlink(path.join(__dirname, '../sample.map'), function() { | ||
fs.unlink(path.join(__dirname, '../sample.css'), function() { | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); |
@@ -7,17 +7,2 @@ /*jshint multistr:true */ | ||
var scssStr = '#navbar {\ | ||
width: 80%;\ | ||
height: 23px; }\ | ||
#navbar ul {\ | ||
list-style-type: none; }\ | ||
#navbar li {\ | ||
float: left;\ | ||
a {\ | ||
font-weight: bold; }}\ | ||
@mixin keyAnimation($name, $attr, $value) {\ | ||
@-webkit-keyframes #{$name} {\ | ||
0% { #{$attr}: $value; }\ | ||
}\ | ||
}'; | ||
var expectedCommentsScssStr = '/* line 1, ' + sampleFilename + ' */\n\ | ||
@@ -39,19 +24,2 @@ #navbar {\n\ | ||
var expectedDebugScssStr = '@media -sass-debug-info{filename{font-family:file\:' + sampleFilename + '}line{font-family:\\000031}}\n\ | ||
#navbar {\n\ | ||
width: 80%;\n\ | ||
height: 23px; }\n\ | ||
\n\ | ||
@media -sass-debug-info{filename{font-family:file\:' + sampleFilename + '}line{font-family:\\000035}}\n\ | ||
#navbar ul {\n\ | ||
list-style-type: none; }\n\ | ||
\n\ | ||
@media -sass-debug-info{filename{font-family:file\:' + sampleFilename + '}line{font-family:\\000038}}\n\ | ||
#navbar li {\n\ | ||
float: left; }\n\ | ||
@media -sass-debug-info{filename{font-family:file\:' + sampleFilename + '}line{font-family:\\0000310}}\n\ | ||
#navbar li a {\n\ | ||
font-weight: bold; }\n'; | ||
describe("compile file with source comments", function() { | ||
@@ -58,0 +26,0 @@ it("should compile with render and comment outputs", function(done) { |
@@ -41,3 +41,3 @@ /*jshint multistr:true */ | ||
it("should compile with render", function(done) { | ||
sass.render(scssStr, function(err, css) { | ||
sass.render(scssStr, function(err) { | ||
done(err); | ||
@@ -98,2 +98,15 @@ }); | ||
it("should have a error status of 1 for bad css", function(done) { | ||
sass.render({ | ||
data: '{zzz}', | ||
success: function(css) { | ||
console.log(css); | ||
}, | ||
error: function(error, status) { | ||
assert.equal(status, 1); | ||
done(); | ||
} | ||
}); | ||
}); | ||
it("should match compiled string with renderSync", function(done) { | ||
@@ -116,3 +129,3 @@ done(assert.equal(sass.renderSync({data: scssStr}), expectedRender)); | ||
success: function (css) { | ||
done(assert.equal(css, "body {\n background: red;\n color: blue; }\n")); | ||
done(assert.equal(css, "body {\n background: red;\n color: #0000fe; }\n")); | ||
}, | ||
@@ -122,3 +135,3 @@ error: function (error) { | ||
} | ||
}) | ||
}); | ||
}); | ||
@@ -140,3 +153,3 @@ }); | ||
it("should compile with renderSync", function(done) { | ||
it("should compile with renderSync", function(done) { | ||
done(assert.ok(sass.renderSync({file: sampleFilename}))); | ||
@@ -143,0 +156,0 @@ }); |
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
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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
185
5487033
6
1
114
888
8
4
+ Addedchalk@~0.3.0
+ Addednan@~0.6.0
+ Addedansi-styles@0.2.0(transitive)
+ Addedchalk@0.3.0(transitive)
+ Addedhas-color@0.1.7(transitive)
+ Addednan@0.6.0(transitive)
- Removedcolors@0.6.0-1
- Removedcolors@0.6.0-1(transitive)