Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cssproc

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cssproc - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

18

lib/index.js

@@ -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);

2

package.json

@@ -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 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc