postcss-url
Advanced tools
Comparing version 7.1.2 to 7.2.0
@@ -1,3 +0,7 @@ | ||
# 7.1.2 - 2017-08-11 | ||
#7.2.0 - 2017-10-17 | ||
Added: `assetsPath` option for `rebase` | ||
#7.1.2 - 2017-08-11 | ||
Fixed: wrap url by quotes for inlined svg ([#78](https://github.com/postcss/postcss-url/issues/78)) | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "postcss-url", | ||
"version": "7.1.2", | ||
"version": "7.2.0", | ||
"description": "PostCSS plugin to rebase or inline on url().", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -138,2 +138,3 @@ # postcss-url | ||
* `rebase` - _default_ | ||
* `assetsPath` - directory to copy assets (relative to `to` or absolute) | ||
* `inline` | ||
@@ -140,0 +141,0 @@ * `basePath` - path or array of paths to search assets (relative to `from`, or absolute) |
'use strict'; | ||
const path = require('path'); | ||
const normalize = require('../lib/paths').normalize; | ||
const paths = require('../lib/paths'); | ||
const normalize = paths.normalize; | ||
const getAssetsPath = paths.getAssetsPath; | ||
@@ -12,8 +14,10 @@ /** | ||
* @param {PostcssUrl~Dir} dir | ||
* @param {PostcssUrl~Option} options | ||
* | ||
* @returns {String|Undefined} | ||
*/ | ||
module.exports = function(asset, dir) { | ||
module.exports = function(asset, dir, options) { | ||
const dest = getAssetsPath(dir.to, options && options.assetsPath || ''); | ||
const rebasedUrl = normalize( | ||
path.relative(dir.to, asset.absolutePath) | ||
path.relative(dest, asset.absolutePath) | ||
); | ||
@@ -20,0 +24,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
36154
650
259