Commit 10018d90 by Nick Schonning

Merge pull request #205 from nschonni/jshinting

Add JSHinting and EditorConfig
parents f4cb0f4e bf2e9293
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org
root = true
[*]
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = spaces
indent_size = 2
node_modules/
\ No newline at end of file
......@@ -6,5 +6,10 @@
"trailing": true,
"undef": true,
"unused": true,
"expr":true
"expr":true,
"multistr": true,
"globals": {
"it": true,
"describe": true
}
}
\ No newline at end of file
......@@ -42,7 +42,7 @@ if (!force && !process.env.SKIP_NODE_SASS_TESTS) {
mocha.addFile(path.resolve(__dirname, "test", "test.js"));
var runner = mocha.run(function (done) {
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.');
......
......@@ -3,18 +3,18 @@
* Module dependencies.
*/
var connect = require('connect')
, sass = require('../sass');
var connect = require('connect'),
sass = require('../sass');
// Setup server
// $ curl http://localhost:3000/test.css
var server = connect.createServer(
sass.middleware({
src: __dirname
, dest: __dirname + '/public'
, debug: true
, outputStyle: 'compressed'
src: __dirname,
dest: __dirname + '/public',
debug: true,
outputStyle: 'compressed'
}),
connect.static(__dirname + '/public')
);
......
......@@ -26,6 +26,7 @@
"scripts": {
"install": "node build.js",
"test": "mocha test",
"pretest": "jshint .",
"prepublish": "bash scripts/prepublish.sh"
},
"bin": {
......@@ -42,5 +43,8 @@
"mocha": "1.13.x",
"chalk": "~0.3.0",
"nan": "~0.6.0"
},
"devDependencies": {
"jshint": "~2.4.0"
}
}
......@@ -24,14 +24,14 @@ var SASS_OUTPUT_STYLE = {
expanded: 1,
compact: 2,
compressed: 3
};
};
var SASS_SOURCE_COMMENTS = {
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, comments;
......@@ -52,7 +52,7 @@ var deprecatedRender = function(css, callback, options) {
var errCallback = function(err) {
callback(err);
};
var oldCallback = function(css, err) {
var oldCallback = function(css) {
callback(null, css);
};
return binding.render(css, oldCallback, errCallback, options.paths.join(':'), options.style, options.comments);
......
var sass = require('./sass');
var scssStr = '#navbar {\
width: 80%;\
height: 23px; }\
#navbar ul {\
list-style-type: none; }\
#navbar li {\
float: left;\
a {\
font-weight: bold; }}';
sass.render(scssStr, function(err, css){
console.log(css)
})
......@@ -2,7 +2,6 @@ var path = require('path'),
assert = require('assert'),
fs = require('fs'),
exec = require('child_process').exec,
sass = require('../sass'),
cli = require('../lib/cli'),
cliPath = path.resolve(__dirname, '../bin/node-sass'),
......@@ -37,7 +36,7 @@ describe('cli', function() {
exec('node ' + cliPath + ' ' + sampleFilename, {
cwd: __dirname
}, function(err, stdout, stderr) {
}, function() {
fs.exists(resultPath, function(exists) {
assert(exists);
......@@ -51,7 +50,7 @@ describe('cli', function() {
exec('node ' + cliPath + ' ' + sampleFilename + ' ../out.css', {
cwd: __dirname
}, function(err, stdout, stderr) {
}, function() {
fs.exists(resultPath, function(exists) {
assert(exists);
......@@ -95,7 +94,7 @@ describe('cli', function() {
var resultPath = path.join(__dirname, '../output.css');
var emitter = cli(['--output', resultPath, path.join(__dirname, 'sample.scss')]);
emitter.on('error', done);
emitter.on('write', function(err, file, css){
emitter.on('write', function(){
fs.exists(resultPath, function(exists) {
assert(exists);
fs.unlink(resultPath, done);
......@@ -139,5 +138,4 @@ describe('cli', function() {
});
});
});
......@@ -4,21 +4,6 @@ var assert = require('assert');
var sampleFilename = require('path').resolve(__dirname, 'sample.scss');
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\
#navbar {\n\
width: 80%;\n\
......@@ -35,23 +20,6 @@ var expectedCommentsScssStr = '/* line 1, ' + sampleFilename + ' */\n\
#navbar li a {\n\
font-weight: bold; }\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() {
it("should compile with render and comment outputs", function(done) {
sass.render({
......
......@@ -38,7 +38,7 @@ var expectedRender = '#navbar {\n\
describe("DEPRECATED: compile scss", function() {
it("should compile with render", function(done) {
sass.render(scssStr, function(err, css) {
sass.render(scssStr, function(err) {
done(err);
});
});
......@@ -98,6 +98,7 @@ describe("compile scss", function() {
sass.render({
data: '{zzz}',
success: function(css) {
console.log(css);
},
error: function(error, status) {
assert.equal(status, 1);
......@@ -128,7 +129,7 @@ describe("compile file with include paths", function(){
error: function (error) {
done(error);
}
})
});
});
});
......
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