Skip to content

Commit 88e3a5a

Browse files
committed
Add banner
1 parent ebe3761 commit 88e3a5a

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

.changeset/fine-frogs-judge.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@devup-ui/wasm": patch
3+
---
4+
5+
Add css banner

libs/sheet/src/lib.rs

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -543,13 +543,32 @@ impl StyleSheet {
543543
current_css
544544
}
545545

546+
fn create_header(&self) -> String {
547+
format!(
548+
"/*! devup-ui v{version} | Apache License 2.0 | https://devup-ui.com */",
549+
// get version from package.json
550+
version = include_str!("../../../bindings/devup-ui-wasm/package.json")
551+
.lines()
552+
.find(|line| line.contains("\"version\""))
553+
.unwrap()
554+
.split(":")
555+
.nth(1)
556+
.unwrap()
557+
.trim()
558+
.replace("\"", ""),
559+
)
560+
}
561+
546562
pub fn create_css(&self, filename: Option<&str>, import_main_css: bool) -> String {
547-
let mut css = self
548-
.imports
549-
.values()
550-
.flatten()
551-
.map(|import| format!("@import \"{import}\";"))
552-
.collect::<String>();
563+
let mut css = format!(
564+
"{}{}",
565+
self.create_header(),
566+
self.imports
567+
.values()
568+
.flatten()
569+
.map(|import| format!("@import \"{import}\";"))
570+
.collect::<String>()
571+
);
553572

554573
let write_global = filename.is_none();
555574

0 commit comments

Comments
 (0)