Skip to content

Commit 1339540

Browse files
committed
feat: append_from_resource should export warnings
1 parent 871dcae commit 1339540

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

float-pigment-css/src/group.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,14 +685,24 @@ impl StyleSheetGroup {
685685
path: &str,
686686
scope: Option<NonZeroUsize>,
687687
) -> u16 {
688+
self.append_from_resource_with_warnings(res, path, scope).0
689+
}
690+
691+
/// Append a style sheet from the resource, returning its index and warnings like @import not found.
692+
pub fn append_from_resource_with_warnings(
693+
&mut self,
694+
res: &StyleSheetResource,
695+
path: &str,
696+
scope: Option<NonZeroUsize>,
697+
) -> (u16, Vec<Warning>) {
688698
let path = drop_css_extension(path);
689-
let (ss, _warnings) = res.link(path, scope);
699+
let (ss, warnings) = res.link(path, scope);
690700
let ret = self.sheets.len();
691701
if Self::is_invalid_index(ret) {
692702
panic!("The number of stylesheets has reached the maximum limit.")
693703
}
694704
self.sheets.push(ss);
695-
ret as u16
705+
(ret as u16, warnings)
696706
}
697707

698708
/// Replace a style sheet from the resource by its index.

0 commit comments

Comments
 (0)