postcss-import-url
Advanced tools
Comparing version 5.0.0 to 5.1.0
@@ -0,1 +1,8 @@ | ||
# [5.1.0](https://github.com/unlight/postcss-import-url/compare/v5.0.0...v5.1.0) (2020-04-04) | ||
### Features | ||
* supports multiple url resolves ([4997931](https://github.com/unlight/postcss-import-url/commit/4997931bf216c8b740fae7518c13cb457e840053)) | ||
# [5.0.0](https://github.com/unlight/postcss-import-url/compare/v4.0.0...v5.0.0) (2020-03-01) | ||
@@ -2,0 +9,0 @@ |
18
index.js
@@ -9,3 +9,3 @@ var postcss = require('postcss'); | ||
recursive: true, | ||
resolveURLs: false, | ||
resolveUrls: false, | ||
modernBrowser: false, | ||
@@ -16,3 +16,3 @@ userAgent: null, | ||
var url = require('url'); | ||
var urlRegexp = /url\(["'].+?['"]\)/; | ||
var urlRegexp = /url\(["']?.+?['"]?\)/g; | ||
@@ -31,3 +31,3 @@ function postcssImportUrl(options) { | ||
if (!isUrl(remoteFile)) return; | ||
imports[imports.length] = createPromise(remoteFile, options).then(function(r) { | ||
imports[imports.length] = createPromise(remoteFile, options).then(function (r) { | ||
var newNode = postcss.parse(r.body); | ||
@@ -46,3 +46,3 @@ var mediaQueries = params.slice(1).join(' '); | ||
// Convert relative paths to absolute paths | ||
newNode = newNode.replaceValues(urlRegexp, { fast: 'url(' }, function(url) { | ||
newNode = newNode.replaceValues(urlRegexp, { fast: 'url(' }, function (url) { | ||
return resolveUrls(url, remoteFile); | ||
@@ -55,3 +55,3 @@ }); | ||
: Promise.resolve(newNode); | ||
return p.then(function(tree) { | ||
return p.then(function (tree) { | ||
atRule.replaceWith(tree); | ||
@@ -61,3 +61,3 @@ }); | ||
}); | ||
return Promise.all(imports).then(function() { | ||
return Promise.all(imports).then(function () { | ||
return tree; | ||
@@ -94,8 +94,8 @@ }); | ||
function executor(resolve, reject) { | ||
var request = hh.get(reqOptions, function(response) { | ||
var request = hh.get(reqOptions, function (response) { | ||
var body = ''; | ||
response.on('data', function(chunk) { | ||
response.on('data', function (chunk) { | ||
body += chunk.toString(); | ||
}); | ||
response.on('end', function() { | ||
response.on('end', function () { | ||
resolve({ | ||
@@ -102,0 +102,0 @@ body: body, |
{ | ||
"name": "postcss-import-url", | ||
"version": "5.0.0", | ||
"version": "5.1.0", | ||
"description": "PostCSS plugin inlines remote files.", | ||
@@ -26,3 +26,3 @@ "keywords": [ | ||
"devDependencies": { | ||
"@semantic-release/changelog": "^5.0.0", | ||
"@semantic-release/changelog": "^5.0.1", | ||
"postcss": ">=6 <8", | ||
@@ -37,3 +37,3 @@ "@semantic-release/git": "^9.0.0", | ||
"precise-commits": "^1.0.2", | ||
"prettier": "^1.19.1", | ||
"prettier": "^2.0.2", | ||
"semantic-release": "^17.0.4", | ||
@@ -40,0 +40,0 @@ "tcp-ping": "^0.1.1" |
Sorry, the diff of this file is not supported yet
10974