Added fallback to absolute URL on failure to resolve CSS stylesheet @imports

pull/78/head
Emi Simpson 5 years ago
parent 11bbfc0851
commit ef7ddcd434
No known key found for this signature in database
GPG Key ID: 68FAB2E2E6DFC98B

@ -4,6 +4,7 @@ use self::base64::encode;
use http::retrieve_asset;
use regex::Regex;
use url::{ParseError, Url};
use std::io::{stderr, Write};
lazy_static! {
static ref HAS_PROTOCOL: Regex = Regex::new(r"^[a-z0-9]+:").unwrap();
@ -132,7 +133,16 @@ pub fn resolve_css_imports(
opt_insecure,
).map(|(a, _)| a),
}.unwrap_or_else(|_| EMPTY_STRING.clone());
}.unwrap_or_else(|e| {
writeln!(
stderr(),
"Warning: {}",
e,
).unwrap();
//If failed to resolve, replace with absolute URL
embedded_url
});
let replacement = format!("\"{}\"", &content);

Loading…
Cancel
Save