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.3 to 0.0.4

7

lib/index.js

@@ -33,3 +33,3 @@

if (!item.match(/^https?:\/\//) && (item.indexOf('.') > -1)) {
URI = url.parse(options.base);
URI = url.parse(options.base, false, true);
top = path.dirname(options.path);

@@ -48,3 +48,4 @@ resolved = path.resolve(top, item);

expanded = URI.protocol + '//' + URI.hostname + path.join(URI.pathname, relative).replace(/\\\\|\\/g, '/');
expanded = (URI.protocol || '') + (URI.hostname ? '//' + URI.hostname : '') +
path.join(URI.pathname, relative).replace(/\\\\|\\/g, '/');

@@ -57,3 +58,3 @@ str = str.replace(baseItem, baseItem.replace(item, expanded));

exports.parse = function(options, str, callback) {
var items = str.match(REGEX_FIND);

@@ -60,0 +61,0 @@

@@ -5,3 +5,3 @@ {

"author": "Dav Glass <davglass@gmail.com>",
"version": "0.0.3",
"version": "0.0.4",
"main": "./lib/index.js",

@@ -8,0 +8,0 @@ "devDependencies": {

@@ -64,2 +64,10 @@ CSS Relative URL Processor

Base
----
The value of `base` could be:
* `http://foobar.com/path/to` where protocol will be forced to HTTP
* `https://foobar.com/path/to` where protocol will be forced to SSL
* `//foobar.com/path/to` which is protocol agnostic where it uses the protocol for the css file that contains the images.
* `/path/to` for absolute paths where it uses the domain and protocol from the css file that contains the images.

@@ -360,3 +360,3 @@ /*jslint maxlen: 500 */

str += '};\n';
assert.equal(str, topic);

@@ -412,2 +412,38 @@ }

}
},
'base as absolute path - /path/to': {
topic: function() {
var str = '.yui-test-cssprocessor {\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: '/path/to/build/'
}, str, this.callback);
},
'and should return /path/to/build/foo.gif': function(topic) {
var str = '.yui-test-cssprocessor {\n';
str += ' background: url(/path/to/build/foo/bar/baz/foo.gif);\n';
str += '};\n';
assert.equal(str, topic);
}
},
'base without procol - //foobar.com': {
topic: function() {
var str = '.yui-test-cssprocessor {\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/'
}, str, this.callback);
},
'and should return /path/to/build/foo.gif': function(topic) {
var str = '.yui-test-cssprocessor {\n';
str += ' background: url(//foobar.com/build/foo/bar/baz/foo.gif);\n';
str += '};\n';
assert.equal(str, topic);
}
}

@@ -414,0 +450,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