Skip to content

Commit

Permalink
feat: update css variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ifiokjr committed May 29, 2023
1 parent 11604ab commit 108eccd
Show file tree
Hide file tree
Showing 15 changed files with 779 additions and 1,883 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions crates/skribble_core/src/config/css_variables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,15 @@ impl CssVariable {
}
}

writeln!(writer, "@property {variable_name} {{")?;
let mut indented_writer = indent_writer();
writeln!(indented_writer, "syntax: \"{syntax}\";")?;
writeln!(indented_writer, "inherits: true;")?;
writeln!(indented_writer, "initial-value: {value};")?;
write!(writer, "{}", indented_writer.get_ref())?;
writeln!(writer, "}}")?;
if !value.is_empty() {
writeln!(writer, "@property {variable_name} {{")?;
let mut indented_writer = indent_writer();
writeln!(indented_writer, "syntax: \"{syntax}\";")?;
writeln!(indented_writer, "inherits: true;")?;
writeln!(indented_writer, "initial-value: {value};")?;
write!(writer, "{}", indented_writer.get_ref())?;
writeln!(writer, "}}")?;
}

Ok(())
}
Expand Down
3 changes: 1 addition & 2 deletions crates/skribble_core/src/config/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ impl Formatter {
files.replace(generated);
}

println!("Formatted files: {tmpdir:?}");
// fs::remove_dir_all(&tmpdir)?;
fs::remove_dir_all(&tmpdir)?;

Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/skribble_core/src/css/__tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ fn create_config() -> StyleConfig {
CssVariable::builder()
.name("custom")
.variable("--c")
.value("")
.value("inherit")
.description("A custom variable")
.build(),
CssVariable::builder()
Expand Down
4 changes: 2 additions & 2 deletions crates/skribble_core/src/css/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ expression: css
@property --sk-c {
syntax: "*";
inherits: true;
initial-value: ;
initial-value: inherit;
}
@layer default {
:root {
--sk-c: ;
--sk-c: inherit;
}
.needs-custom\:\$px {
--sk-c: ;
Expand Down
6 changes: 0 additions & 6 deletions crates/skribble_preset/src/__tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,6 @@ fn css_from_class_names(#[case] id: &str, #[case] names: &[&str]) -> AnyEmptyRes

classes.sort_by_class();

println!("CLASSES: {classes:#?}, LENGTH: {}", classes.len());

for class in classes.iter() {
println!("{:#?}", class);
}

set_snapshot_suffix!("{id}");
insta::assert_display_snapshot!(classes.to_skribble_css(runner_config)?);

Expand Down
4 changes: 2 additions & 2 deletions crates/skribble_preset/src/data/atoms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,7 @@ lazy_static! {
.styles(indexmap! { &gradient_from_position => none })
.build(),
Atom::builder()
.name("via")
.name("via-position")
.values(ColorField::default())
.children(vec!["gradient-reference"])
.styles({
Expand All @@ -1257,7 +1257,7 @@ lazy_static! {
.styles(indexmap! { &gradient_via_position => none })
.build(),
Atom::builder()
.name("to")
.name("to-color")
.values(ColorField::default())
.children(vec!["gradient-reference"])
.styles({
Expand Down

0 comments on commit 108eccd

Please sign in to comment.