Comparing version 0.0.4 to 0.0.5
@@ -9,3 +9,4 @@ | ||
var path = require('path'), | ||
url = require('url'); | ||
url = require('url'), | ||
index = -1; | ||
@@ -22,2 +23,15 @@ // url(../../foo.png) | ||
var getBase = function(base) { | ||
if (base instanceof Array) { | ||
var length = base.length; | ||
if (index === length - 1) { | ||
index = 0; | ||
} else { | ||
index++; | ||
} | ||
return base[index]; | ||
} else { | ||
return base; | ||
} | ||
}; | ||
@@ -35,3 +49,3 @@ var normalize = function(options, str, m) { | ||
if (!item.match(/^https?:\/\//) && (item.indexOf('.') > -1)) { | ||
URI = url.parse(options.base, false, true); | ||
URI = url.parse(getBase(options.base), false, true); | ||
top = path.dirname(options.path); | ||
@@ -38,0 +52,0 @@ resolved = path.resolve(top, item); |
@@ -5,3 +5,3 @@ { | ||
"author": "Dav Glass <davglass@gmail.com>", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"main": "./lib/index.js", | ||
@@ -8,0 +8,0 @@ "devDependencies": { |
@@ -447,2 +447,42 @@ /*jslint maxlen: 500 */ | ||
} | ||
}, | ||
'base with multiple domains': { | ||
topic: function() { | ||
var str = '.yui-test-cssprocessor {\n'; | ||
str += ' background: url(foo.gif);\n'; | ||
str += '};\n'; | ||
str += '.yui-test-cssprocessor2 {\n'; | ||
str += ' background: url(foo.gif);\n'; | ||
str += '};\n'; | ||
str += '.yui-test-cssprocessor3 {\n'; | ||
str += ' background: url(foo.gif);\n'; | ||
str += '};\n'; | ||
str += '.yui-test-cssprocessor4 {\n'; | ||
str += ' background: url(foo.gif);\n'; | ||
str += '};\n'; | ||
cssproc.parse({ | ||
root: '/home/yui/src/', | ||
path: '/home/yui/src/foo/bar/baz/file.css', | ||
base: [ | ||
'//foobar.com/build/', | ||
'//s1.foobar.com/build/', | ||
'http://s2.foobar.com/build/' | ||
] | ||
}, str, this.callback); | ||
}, | ||
'and should use multiple domains': function(topic) { | ||
var str = '.yui-test-cssprocessor {\n'; | ||
str += ' background: url(//foobar.com/build/foo/bar/baz/foo.gif);\n'; | ||
str += '};\n'; | ||
str += '.yui-test-cssprocessor2 {\n'; | ||
str += ' background: url(//s1.foobar.com/build/foo/bar/baz/foo.gif);\n'; | ||
str += '};\n'; | ||
str += '.yui-test-cssprocessor3 {\n'; | ||
str += ' background: url(http://s2.foobar.com/build/foo/bar/baz/foo.gif);\n'; | ||
str += '};\n'; | ||
str += '.yui-test-cssprocessor4 {\n'; | ||
str += ' background: url(//foobar.com/build/foo/bar/baz/foo.gif);\n'; | ||
str += '};\n'; | ||
assert.equal(str, topic); | ||
} | ||
} | ||
@@ -449,0 +489,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
30431
620