From 625105f55e98934570731e6c42187a4e83a5bc6b Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 26 Mar 2013 16:29:58 +0200 Subject: [PATCH] switch to single quotes --- lib/clean.js | 18 +++++++++--------- test/binary-test.js | 18 +++++++++--------- test/unit-test.js | 10 +++++----- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lib/clean.js b/lib/clean.js index 60293b62..38e46490 100644 --- a/lib/clean.js +++ b/lib/clean.js @@ -206,12 +206,12 @@ var CleanCSS = { // replace color name with hex values if shorter (or the other way around) ['toHex', 'toName'].forEach(function(type) { - var pattern = "(" + Object.keys(CleanCSS.colors[type]).join('|') + ")"; + var pattern = '(' + Object.keys(CleanCSS.colors[type]).join('|') + ')'; var colorSwitcher = function(match, prefix, colorValue, suffix) { return prefix + CleanCSS.colors[type][colorValue.toLowerCase()] + suffix; }; - replace(new RegExp("([ :,\\(])" + pattern + "([;\\}!\\) ])", 'ig'), colorSwitcher); - replace(new RegExp("(,)" + pattern + "(,)", 'ig'), colorSwitcher); + replace(new RegExp('([ :,\\(])' + pattern + '([;\\}!\\) ])', 'ig'), colorSwitcher); + replace(new RegExp('(,)' + pattern + '(,)', 'ig'), colorSwitcher); }); // replace font weight with numerical value @@ -236,11 +236,11 @@ var CleanCSS = { // restore 0% in hsl/hsla replace(/(hsl|hsla)\(([^\)]+)\)/g, function(match, colorFunction, colorDef) { var tokens = colorDef.split(','); - if (tokens[1] == "0") + if (tokens[1] == '0') tokens[1] = '0%'; - if (tokens[2] == "0") + if (tokens[2] == '0') tokens[2] = '0%'; - return colorFunction + "(" + tokens.join(',') + ")"; + return colorFunction + '(' + tokens.join(',') + ')'; }); // none to 0 @@ -255,9 +255,9 @@ var CleanCSS = { // shorthand notations var shorthandRegex = function(repeats, hasSuffix) { - var pattern = "(padding|margin|border\\-width|border\\-color|border\\-style|border\\-radius):"; + var pattern = '(padding|margin|border\\-width|border\\-color|border\\-style|border\\-radius):'; for (var i = 0; i < repeats; i++) { - pattern += "([\\d\\w\\.%#\\(\\),]+)" + (i < repeats - 1 ? ' ' : ''); + pattern += '([\\d\\w\\.%#\\(\\),]+)' + (i < repeats - 1 ? ' ' : ''); } return new RegExp(pattern + (hasSuffix ? '([;}])' : ''), 'g'); }; @@ -287,7 +287,7 @@ var CleanCSS = { // same 2 values into one replace(shorthandRegex(2, true), function(match, property, size1, size2, suffix) { if (size1 === size2) - return property + ":" + size1 + suffix; + return property + ':' + size1 + suffix; else return match; }); diff --git a/test/binary-test.js b/test/binary-test.js index fd43103b..c1a9e612 100644 --- a/test/binary-test.js +++ b/test/binary-test.js @@ -50,42 +50,42 @@ exports.commandsSuite = vows.describe('binary commands').addBatch({ 'version': binaryContext('-v', { 'should output help': function(error, stdout) { var version = JSON.parse(fs.readFileSync('./package.json')).version; - assert.equal(stdout, version + "\n"); + assert.equal(stdout, version + '\n'); } }), - 'stdin': pipedContext("a{color: #f00}", '', { + 'stdin': pipedContext('a{color: #f00}', '', { 'should output data': function(error, stdout) { - assert.equal(stdout, "a{color:red}"); + assert.equal(stdout, 'a{color:red}'); } }), 'no empty by default': pipedContext('a{}', '', { 'should preserve content': function(error, stdout) { - assert.equal(stdout, "a{}"); + assert.equal(stdout, 'a{}'); } }), 'strip all but first comment': pipedContext('/*!1st*//*! 2nd */a{}', '--s1', { 'should keep the 2nd comment': function(error, stdout) { - assert.equal(stdout, "/*!1st*/a{}"); + assert.equal(stdout, '/*!1st*/a{}'); } }), 'strip all comments': pipedContext('/*!1st*//*! 2nd */a{}', '--s0', { 'should keep the 2nd comment': function(error, stdout) { - assert.equal(stdout, "a{}"); + assert.equal(stdout, 'a{}'); } }), 'empty': pipedContext('a{}', '-e', { 'should preserve content': function(error, stdout) { - assert.equal(stdout, ""); + assert.equal(stdout, ''); } }), 'no relative to path': binaryContext('./test/data/partials-absolute/base.css', { 'should not be able to resolve it fully': function(error, stdout) { - assert.equal(stdout, ".sub{padding:0}.base{margin:0}"); + assert.equal(stdout, '.sub{padding:0}.base{margin:0}'); } }), 'relative to path': binaryContext('-r ./test/data ./test/data/partials-absolute/base.css', { 'should be able to resolve it': function(error, stdout) { - assert.equal(stdout, ".base2{border-width:0}.sub{padding:0}.base{margin:0}"); + assert.equal(stdout, '.base2{border-width:0}.sub{padding:0}.base{margin:0}'); } }), 'from source': binaryContext('./test/data/reset.css', { diff --git a/test/unit-test.js b/test/unit-test.js index 9fb057a9..13349b88 100644 --- a/test/unit-test.js +++ b/test/unit-test.js @@ -110,12 +110,12 @@ vows.describe('clean-units').addBatch({ 'div{height:-moz-calc(3 * 2em + 10px)}' ], 'before colon': [ - "#test{padding-left :0}", - "#test{padding-left:0}" + '#test{padding-left :0}', + '#test{padding-left:0}' ], - 'before colon but not selectors #1': "div :before{}", - 'before colon but not selectors #2': "div ::-webkit-search-decoration{}", - 'before colon but not selectors #3': "div :after{color:red}", + 'before colon but not selectors #1': 'div :before{}', + 'before colon but not selectors #2': 'div ::-webkit-search-decoration{}', + 'before colon but not selectors #3': 'div :after{color:red}', 'windows breaks': [ 'div>a{color:red\r\n }', 'div>a{color:red}' -- 2.34.1