Comparing version 1.1.0 to 1.1.1
@@ -28,3 +28,3 @@ module.exports = function(parser) { | ||
function comment(ch) { | ||
if (token.length === 1 && ch != '*') { | ||
if (token.length === 1 && ch !== '*') { | ||
// oops, not a comment, just a / | ||
@@ -142,3 +142,3 @@ next(prev, prev); | ||
} | ||
}; | ||
} | ||
@@ -149,3 +149,3 @@ function end() { | ||
} else if (token.length) { | ||
t = token.join(''); | ||
var t = token.join(''); | ||
parser.token(t, t); | ||
@@ -152,0 +152,0 @@ } |
@@ -33,7 +33,7 @@ module.exports = function(outputBuffer) { | ||
outputBuffer.push(str); | ||
} | ||
}; | ||
} else { | ||
output = function(str) { | ||
process.stdout.write(str); | ||
} | ||
}; | ||
} | ||
@@ -51,3 +51,3 @@ | ||
function write(str) { | ||
if (!str || !str.length) return; | ||
if (!str || !str.length) { return; } | ||
if (str.slice(0,3) === '/*!' && ! ruleBuffer.length) { | ||
@@ -73,3 +73,3 @@ output(str); | ||
function _buffer1(str) { | ||
if (!str.length) return; | ||
if (!str.length) { return; } | ||
pending = str; | ||
@@ -82,9 +82,9 @@ buffer = _buffer; | ||
function q(str) { | ||
if (!str.length) return; | ||
if (property) value.push(str); | ||
else buffer(str); | ||
if (!str.length) { return; } | ||
if (property) { value.push(str); } | ||
else { buffer(str); } | ||
} | ||
function collapseZeroes() { | ||
t = value.join(''); | ||
var t = value.join(''); | ||
value = []; | ||
@@ -144,3 +144,3 @@ if (t === '0 0' || t === '0 0 0 0' || t === '0 0 0') { | ||
if (((type === '#' || type === 'number') && prev === 'number') || | ||
((type === 'number' || type == 'identifier' || type === '#') && | ||
((type === 'number' || type === 'identifier' || type === '#') && | ||
(prev === 'identifier' || prev === '%' || prev === ')'))) { | ||
@@ -197,3 +197,3 @@ q(' '); | ||
} else if (type === '{') { | ||
if (checkSpace !== -1) checkSpace = -1; // start of a rule, space was correct | ||
if (checkSpace !== -1) { checkSpace = -1; } // start of a rule, space was correct | ||
if (at) { | ||
@@ -215,4 +215,4 @@ at = false; | ||
} | ||
if (pending === ';') pending = '}'; | ||
else buffer(token); | ||
if (pending === ';') { pending = '}'; } | ||
else { buffer(token); } | ||
property = null; | ||
@@ -235,4 +235,4 @@ rule = false; | ||
if (token.slice(1,MS_ALPHA.length+1).toLowerCase() === MS_ALPHA) { | ||
c = token[0]; | ||
a = token.slice(MS_ALPHA.length+1,-2); | ||
var c = token[0]; | ||
var a = token.slice(MS_ALPHA.length+1,-2); | ||
q(c); | ||
@@ -253,9 +253,14 @@ q('alpha(opacity='); | ||
} else { | ||
t = token.toLowerCase(); | ||
var t = token.toLowerCase(); | ||
// values of 0 don't need a unit | ||
if (prev === 'number' && last === '0' && (type === '%' || type === 'identifier')) { | ||
if (UNITS.indexOf(token) == -1) { | ||
if (UNITS.indexOf(token) === -1) { | ||
q(' '); | ||
q(token); | ||
} | ||
// values for line-height don't need a unit | ||
} else if (property === 'font' && type === 'identifier' && value.length > 2 && value[value.length-2] === '/') { | ||
console.log(value, prev, last, type, token); | ||
q(' '); | ||
q(token); | ||
// use 0 instead of none | ||
@@ -265,3 +270,3 @@ } else if (token === 'none' && prev === ':' && NONE_PROPERTIES.indexOf(property) !== -1) { | ||
// force properties to lower case for better gzip compression | ||
} else if (type === 'identifier' && prev != ':') { | ||
} else if (type === 'identifier' && prev !== ':') { | ||
// #aabbcc | ||
@@ -280,9 +285,9 @@ if (prev === '#') { | ||
} else { | ||
if (!property || KEYWORDS.indexOf(t) >= 0) q(t); | ||
else q(token); | ||
if (!property || KEYWORDS.indexOf(t) >= 0) { q(t); } | ||
else { q(token); } | ||
} | ||
// nothing special, just send it along | ||
} else { | ||
if (KEYWORDS.indexOf(t) >= 0) q(t); | ||
else q(token); | ||
if (KEYWORDS.indexOf(t) >= 0) { q(t); } | ||
else { q(token); } | ||
} | ||
@@ -297,7 +302,7 @@ } | ||
if (type === 'number') { | ||
var s = parseInt(token).toString(16).toLowerCase(); | ||
if (s.length < 2) s = '0' + s; | ||
var s = parseInt(token, 10).toString(16).toLowerCase(); | ||
if (s.length < 2) { s = '0' + s; } | ||
buf.push(s); | ||
} else if (type === '(') { | ||
if (prev === 'number') q(' '); | ||
if (prev === 'number') { q(' '); } | ||
q('#'); | ||
@@ -304,0 +309,0 @@ buf = []; |
{ | ||
"name" : "ncss", | ||
"version" : "1.1.0", | ||
"version" : "1.1.1", | ||
"description" : "CSS stream compressor", | ||
@@ -5,0 +5,0 @@ "homepage" : "https://github.com/kurakin/ncss", |
@@ -6,2 +6,4 @@ ncss | ||
[![Still Maintained](http://stillmaintained.com/kurakin/backup.png)](http://stillmaintained.com/kurakin/ncss) | ||
installation | ||
@@ -8,0 +10,0 @@ ------------ |
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
38018
27
16
837