Permalink
Browse files

Reformatted `var` statements to follow one-var-per-line rule.

  • Loading branch information...
1 parent 813ef52 commit ee3eff8f9ffd3887de68537a6ed0d3476274f65b @GoalSmashers GoalSmashers committed Mar 26, 2013
Showing with 45 additions and 45 deletions.
  1. +5 −5 bin/enhancecss
  2. +19 −19 lib/enhance.js
  3. +7 −7 test/binary-test.js
  4. +14 −14 test/embed-test.js
View
@@ -1,10 +1,10 @@
#!/usr/bin/env node
-var argv = require('optimist').argv,
- EnhanceCSS = require('../index'),
- fs = require('fs'),
- path = require('path'),
- util = require('util');
+var argv = require('optimist').argv;
+var EnhanceCSS = require('../index');
+var fs = require('fs');
+var path = require('path');
+var util = require('util');
var options = {
source: null,
View
@@ -5,12 +5,12 @@
* Copyright (C) 2011-2013 GoalSmashers.com
*/
-var fs = require('fs'),
- path = require('path'),
- zlib = require('zlib'),
- crypto = require('crypto'),
- querystring = require('querystring'),
- existsSync = fs.existsSync || path.existsSync;
+var fs = require('fs');
+var path = require('path');
+var zlib = require('zlib');
+var crypto = require('crypto');
+var querystring = require('querystring');
+var existsSync = fs.existsSync || path.existsSync;
var isWindows = process.platform == 'win32';
@@ -22,11 +22,11 @@ var EnhanceCSS = function(options) {
EnhanceCSS.prototype = {
urlPattern: /url\(([^\)]+)\)/g,
process: function(css, callback) {
- var self = this,
- missing = {},
- data = { original: css },
- embedUrls = {},
- allUrls = [];
+ var self = this;
+ var missing = {};
+ var data = { original: css };
+ var embedUrls = {};
+ var allUrls = [];
// Only to find duplicates
(css.match(this.urlPattern) || []).forEach(function(url) {
@@ -198,16 +198,16 @@ EnhanceCSS.prototype = {
return;
if (this.options.cryptedStamp && (pathInfo.query.embed === undefined || this.options.noEmbedVersion)) {
- var source = fs.readFileSync(pathInfo.absolute),
- encrypted = crypto.createHash('md5'),
- toStampedPath = function(path) {
- var extensionDotIndex = path.lastIndexOf('.');
- return path.substring(0, extensionDotIndex) + '-' + stamp + '.' + path.substring(extensionDotIndex + 1);
- };
+ var source = fs.readFileSync(pathInfo.absolute);
+ var encrypted = crypto.createHash('md5');
+ var toStampedPath = function(path) {
+ var extensionDotIndex = path.lastIndexOf('.');
+ return path.substring(0, extensionDotIndex) + '-' + stamp + '.' + path.substring(extensionDotIndex + 1);
+ };
encrypted.update(source.toString('utf8'));
- var stamp = encrypted.digest('hex'),
- targetPath = toStampedPath(pathInfo.absolute);
+ var stamp = encrypted.digest('hex');
+ var targetPath = toStampedPath(pathInfo.absolute);
if (!existsSync(targetPath))
fs.writeFileSync(targetPath, source);
View
@@ -1,10 +1,10 @@
-var vows = require('vows'),
- assert = require('assert'),
- fs = require('fs'),
- path = require('path'),
- exec = require('child_process').exec,
- zlib = require('zlib'),
- existsSync = fs.existsSync || path.existsSync;
+var vows = require('vows');
+var assert = require('assert');
+var fs = require('fs');
+var path = require('path');
+var exec = require('child_process').exec;
+var zlib = require('zlib');
+var existsSync = fs.existsSync || path.existsSync;
var isWindows = process.platform == 'win32';
View
@@ -1,13 +1,13 @@
-var vows = require('vows'),
- assert = require('assert'),
- fs = require('fs'),
- zlib = require('zlib'),
- path = require('path'),
- exec = require('child_process').exec,
- crypto = require('crypto'),
- exists = fs.exists || path.exists,
- existsSync = fs.existsSync || path.existsSync,
- EnhanceCSS = require('../lib/enhance.js');
+var vows = require('vows');
+var assert = require('assert');
+var fs = require('fs');
+var zlib = require('zlib');
+var path = require('path');
+var exec = require('child_process').exec;
+var crypto = require('crypto');
+var exists = fs.exists || path.exists;
+var existsSync = fs.existsSync || path.existsSync;
+var EnhanceCSS = require('../lib/enhance.js');
var append = function(o1, o2) {
for (var k in o2)
@@ -216,8 +216,8 @@ vows.describe('embedding images').addBatch({
topic: runOn('a{background:url(/test/data/gradient.png)}', { cryptedStamp: true, noEmbedVersion: true }),
'once file exists': {
topic: function(css) {
- var self = this,
- stamp = cryptedStamp('gradient.png');
+ var self = this;
+ var stamp = cryptedStamp('gradient.png');
exists(process.cwd() + '/test/data/gradient-' + stamp + '.png', function() {
self.callback(css, stamp);
@@ -239,8 +239,8 @@ vows.describe('embedding images').addBatch({
topic: runOn('a{background:url(/test/data/gradient.png?embed)}', { cryptedStamp: true, noEmbedVersion: true }),
'once file exists': {
topic: function(css) {
- var self = this,
- stamp = cryptedStamp('gradient.png');
+ var self = this;
+ var stamp = cryptedStamp('gradient.png');
exists(process.cwd() + '/test/data/gradient-' + stamp + '.png', function() {
self.callback(css, stamp);

0 comments on commit ee3eff8

Please sign in to comment.