css-resolve-import
Advanced tools
Comparing version 0.0.2 to 0.0.3
{ | ||
"name": "css-resolve-import", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Resolves @import statements in CSS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -7,6 +7,7 @@ module.exports = parse | ||
var stripUTF8ByteOrder = require('./strip-utf8-byte-order') | ||
var stringImportMatcher = /@import ["'](.+)["'];/g | ||
var importMatcher = /@import +(url\()?([^()]+)\)? *;/g | ||
var stringImportMatcher = /@import ["'](.+)["'];?/g | ||
var importMatcher = /@import +(?:url\()?([^()]+)\)?(:? *;)?/g | ||
var urlMatcher = /url\(["']?([^"'()]+)["']?\)/g | ||
var absoluteUrl = /^([a-z][a-z-+.0-9]*:\/)?\//i | ||
var urlWithScheme = /^(?:[a-z][a-z-+.0-9]*:)?\/\//i | ||
var absoluteUrl = /^\//i | ||
var dataUrl = /^data:/ | ||
@@ -27,3 +28,3 @@ | ||
url = url.trim() | ||
if(!url.match(dataUrl) && !url.match(absoluteUrl)) { | ||
if(!url.match(dataUrl) && !url.match(urlWithScheme) && !url.match(absoluteUrl)) { | ||
url = path.join(relRoot, url).replace(/\\/g, '/') | ||
@@ -33,3 +34,7 @@ } | ||
}) | ||
.replace(importMatcher, function(match, junk, file) { | ||
.replace(importMatcher, function(match, file) { | ||
if(file.match(urlWithScheme)) { | ||
return format('@import url(%s);', file) | ||
} | ||
if(!file.match(absoluteUrl)) { | ||
@@ -36,0 +41,0 @@ file = path.join(absRoot, file) |
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
2290
48