postcss-url
Advanced tools
Comparing version 2.0.2 to 2.1.0
@@ -0,1 +1,5 @@ | ||
# 2.1.0 - 2015-03-12 | ||
- Added: related postcss declaration object has been added as a 2nd parameter to the url callback for custom processing | ||
# 2.0.2 - 2015-01-31 | ||
@@ -2,0 +6,0 @@ |
21
index.js
@@ -7,5 +7,5 @@ /** | ||
var mime = require("mime") | ||
var url = require("url"); | ||
var url = require("url") | ||
var SvgEncoder = require("directory-encoder/lib/svg-uri-encoder.js") | ||
var reduceFunctionCall = require("reduce-function-call"); | ||
var reduceFunctionCall = require("reduce-function-call") | ||
@@ -54,3 +54,3 @@ /** | ||
if (typeof mode === "function") { | ||
return processCustom(quote, value, mode); | ||
return processCustom(quote, value, mode, decl) | ||
} | ||
@@ -90,5 +90,6 @@ | ||
* @param {Function} cb | ||
* @param {Object} decl | ||
*/ | ||
function processCustom(quote, value, cb) { | ||
var newValue = cb(value) | ||
function processCustom(quote, value, cb, decl) { | ||
var newValue = cb(value, decl) | ||
return createUrl(quote, newValue) | ||
@@ -114,5 +115,5 @@ } | ||
if (path.sep == "\\") { | ||
newPath = newPath.replace(/\\/g, "\/"); | ||
newPath = newPath.replace(/\\/g, "\/") | ||
} | ||
return createUrl(quote, newPath); | ||
return createUrl(quote, newPath) | ||
} | ||
@@ -137,5 +138,5 @@ | ||
// ignore URLs with hashes/fragments, they can't be inlined | ||
var link = url.parse(value); | ||
var link = url.parse(value) | ||
if (link.hash) { | ||
return createUrl(quote, value); | ||
return createUrl(quote, value) | ||
} | ||
@@ -155,3 +156,3 @@ | ||
var mimeType = mime.lookup(file) | ||
var stats = fs.statSync(file); | ||
var stats = fs.statSync(file) | ||
if (stats.size >= maxSize) { | ||
@@ -158,0 +159,0 @@ return createUrl(quote, newPath) |
{ | ||
"name": "postcss-url", | ||
"version": "2.0.2", | ||
"version": "2.1.0", | ||
"description": "PostCSS plugin to rebase or inline on url().", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -52,3 +52,3 @@ # postcss-url [![Build Status](https://travis-ci.org/postcss/postcss-url.png)](https://travis-ci.org/postcss/postcss-url) | ||
Custom transform function. Takes one argument (original url) and should return the transformed url. | ||
Custom transform function. Takes two arguments (original url, related postcss declaration object) and should return the transformed url. | ||
You can use this option to adjust urls for CDN. | ||
@@ -55,0 +55,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
11125
183