Skip to content

Commit a639ad6

Browse files
committed
Allow for additional CSS rules
To do things like use @font-face to load fonts
1 parent 3808764 commit a639ad6

File tree

8 files changed

+9
-1
lines changed

8 files changed

+9
-1
lines changed

example-figma-files/gov-uk-design-system-components/button.html

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
><head
44
><meta charset="utf-8" /><title>Button</title
55
><style type="text/css">
6+
67
body {
78
--Text-Primary: #0b0c0c;
89
--Focus-Default: #fd0;

example-figma-files/gov-uk-design-system-components/cookie-banner.html

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
><head
44
><meta charset="utf-8" /><title>Cookie banner</title
55
><style type="text/css">
6+
67
body {
78
--Text-Primary: #0b0c0c;
89
--Link-Default: #1d70b8;

example-figma-files/gov-uk-design-system-components/footer.html

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
><head
44
><meta charset="utf-8" /><title>Footer</title
55
><style type="text/css">
6+
67
body {
78
--Text-Primary: #0b0c0c;
89
--Text-Secondary: #505a5f;

example-figma-files/gov-uk-design-system-components/get-started-page.html

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
><head
44
><meta charset="utf-8" /><title>👋 Getting Started</title
55
><style type="text/css">
6+
67
body {
78
--Text-Primary: #0b0c0c;
89
--Text-Secondary: #505a5f;

example-figma-files/gov-uk-design-system-components/header.html

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
><head
44
><meta charset="utf-8" /><title>Header</title
55
><style type="text/css">
6+
67
body {
78
--Text-Primary: #0b0c0c;
89
--Desktop-Heading-Medium: 700 24px / 30px "GDS Transport Website",arial,sans-serif;

example-figma-files/gov-uk-design-system-components/tag.html

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
><head
44
><meta charset="utf-8" /><title>Tag</title
55
><style type="text/css">
6+
67
body {
78
--Background: #fff;
89
--Other-Blue: #1d70b8;

figma-html/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ pub fn intermediate_node_to_html_writer(
5656
writer: &mut impl Write,
5757
node: &IntermediateNode,
5858
css_variables: &CSSVariablesMap,
59+
additional_css_rules: &str,
5960
) -> Result<(), std::io::Error> {
6061
let mut naive_css = "margin: 0;".to_string();
6162
for v in css_variables.values() {
@@ -76,6 +77,7 @@ pub fn intermediate_node_to_html_writer(
7677
><head
7778
><meta charset="utf-8" /><title>{}</title
7879
><style type="text/css">
80+
{additional_css_rules}
7981
body {{{}}}
8082
</style></head
8183
><body

src/to_html/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ pub fn main(
2525
|| mutator::elevate_frame_appearance_properties(&mut node, &mut css_variables)
2626
{}
2727

28-
intermediate_node_to_html_writer(stdout, &node, &css_variables)
28+
intermediate_node_to_html_writer(stdout, &node, &css_variables, "")
2929
.context("Failed to write HTML to stdout")
3030
}

0 commit comments

Comments
 (0)