Socket
Socket
Sign inDemoInstall

postcss-url

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-url - npm Package Compare versions

Comparing version 5.0.2 to 5.1.0

5

CHANGELOG.md

@@ -0,1 +1,6 @@

# 5.1.0 - 2016-01-19
- Added: `filter` option
([#61](https://github.com/postcss/postcss-url/pull/61))
# 5.0.2 - 2015-10-12

@@ -2,0 +7,0 @@

45

index.js

@@ -14,2 +14,3 @@ /**

var pathIsAbsolute = require("path-is-absolute")
var minimatch = require("minimatch")
/**

@@ -89,2 +90,28 @@ * @typedef UrlRegExp

/**
* Returns wether the given filename matches the given pattern
* Allways returns true if the given pattern is empty
*
* @param {String} filename the processed filename
* @param {String|RegExp|Function} pattern A minimatch string,
* regular expression or function to test the filename
*
* @return {Boolean}
*/
function matchesFilter(filename, pattern) {
if (typeof pattern === "string") {
pattern = minimatch.filter(pattern)
}
if (pattern instanceof RegExp) {
return pattern.test(filename)
}
if (pattern instanceof Function) {
return pattern(filename)
}
return true
}
/**
* @callback PostcssUrl~DeclProcessor

@@ -111,3 +138,3 @@ * @param {Object} decl declaration

if (isCustom || ! isUrlShouldBeIgnored(oldUrl)) {
if (isCustom || !isUrlShouldBeIgnored(oldUrl)) {
newUrl = cb(result, from, dirname, oldUrl, to, options, decl)

@@ -184,2 +211,3 @@ }

var basePath = options.basePath
var filter = options.filter
var fullFilePath

@@ -219,3 +247,3 @@

if (!fs.existsSync(file)) {
result.warn("Can't read file '" + file + "', ignoring", {node: decl})
result.warn("Can't read file '" + file + "', ignoring", { node: decl })
return

@@ -230,6 +258,10 @@ }

if (!matchesFilter(file, filter)) {
return processFallback()
}
var mimeType = mime.lookup(file)
if (!mimeType) {
result.warn("Unable to find asset mime-type for " + file, {node: decl})
result.warn("Unable to find asset mime-type for " + file, { node: decl })
return

@@ -259,3 +291,3 @@ }

if (from === to) {
result.warn("Option `to` of postcss is required, ignoring", {node: decl})
result.warn("Option `to` of postcss is required, ignoring", { node: decl })
return

@@ -283,3 +315,3 @@ }

catch (err) {
result.warn("Can't read file '" + filePath + "', ignoring", {node: decl})
result.warn("Can't read file '" + filePath + "', ignoring", { node: decl })
return

@@ -331,4 +363,5 @@ }

assetPath = assetPath.replace(/\\/g, "\/")
}
}
return assetPath
}

22

package.json
{
"name": "postcss-url",
"version": "5.0.2",
"version": "5.1.0",
"description": "PostCSS plugin to rebase or inline on url().",

@@ -17,6 +17,3 @@ "keywords": [

"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/postcss/postcss-url.git"
},
"repository": "https://github.com/postcss/postcss-url.git",
"files": [

@@ -29,2 +26,3 @@ "index.js"

"mime": "^1.2.11",
"minimatch": "^3.0.0",
"mkdirp": "^0.5.0",

@@ -35,3 +33,4 @@ "path-is-absolute": "^1.0.0",

"devDependencies": {
"eslint": "^1.1.0",
"eslint": "^1.10.3",
"eslint-config-i-am-meticulous": "^1.0.0",
"postcss-import": "^7.0.0",

@@ -41,4 +40,13 @@ "tape": "^4.0.3"

"scripts": {
"test": "eslint . && tape test"
"lint": "eslint --fix .",
"tests": "tape test",
"test": "npm run lint && npm run tests"
},
"eslintConfig": {
"extends": "eslint-config-i-am-meticulous",
"parser": "espree",
"rules": {
"no-var": 0
}
}
}

@@ -71,9 +71,14 @@ # postcss-url

And should return the transformed url.
And should return the transformed url.
You can use this option to adjust urls for CDN.
#### `maxSize`
_(default: `14`)_
Specify the maximum file size to inline (in kbytes)
#### `filter`
A regular expression e.g. `/\.svg$/`, a [minimatch string](https://github.com/isaacs/minimatch) e.g. `'**/*.svg'` or a custom filter function to determine wether a file should be inlined.
#### `fallback`

@@ -80,0 +85,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