Skip to content

Commit

Permalink
🐛 fix debugging/dump mixins
Browse files Browse the repository at this point in the history
they errored when folks ran them
  • Loading branch information
philschatz committed Nov 3, 2023
1 parent fcd70ce commit dc866ea
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 10 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ Workarounds:
- Use a VPN or work from a different location (aka different IP address)
- Comment out the line `RUN dart pub get` in the Dockerfile, build the image, and run `dart pub get` within the container to get the dependencies manually

# Troubleshooting styles

You can add the following mixing to the bottom of the `book.scss` file to print out additional debugging information:

```scss
// This one is probably the most useful. It shows all the settings, what they are set to, and if they have been overridden
@include debug_settings();

@include debug_settings_manifest();
@include debug_shapes();
@include debug_enums();
```

# Important Links
- [CE Team Confluence Documentation](https://openstax.atlassian.net/wiki/spaces/CE/overview)
- [How to Release CE Styles](https://openstax.atlassian.net/l/c/TjrhH68R)
Expand Down
16 changes: 8 additions & 8 deletions styles/framework/design-shape/_init.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ $FRAMEWORK_SPACE_PLACE: ();
@include error(error_message($unwrapped_shape));
} @else {
$FRAMEWORK_SPACE_PLACE: map-merge(
$FRAMEWORK_SPACE_PLACE,
$FRAMEWORK_SPACE_PLACE,
($name: map-merge(
$unwrapped_shape,
(_parent: enum('Object:::NONE'))
Expand All @@ -94,7 +94,7 @@ $FRAMEWORK_SPACE_PLACE: ();
$unwrapped,
(_components: $shape_components)
);
}
}
}

@function get_nested_components($components, $subselector_prefix: '') {
Expand All @@ -111,7 +111,7 @@ $FRAMEWORK_SPACE_PLACE: ();
$component_name: map-deep-get($component, _name);
$component_subselector: map-deep-get($component, _subselector);
$component_properties: map-deep-get($component, _properties);

@if is_error($component_name) {
@return $component_name;
}
Expand All @@ -127,7 +127,7 @@ $FRAMEWORK_SPACE_PLACE: ();
}

$computed_subselector: #{$subselector_prefix}#{$component_subselector};

$copied_component: map-merge($copied_component, (_name: $component_name));
$copied_component: map-merge($copied_component, (_subselector: $computed_subselector));
$copied_component: map-merge($copied_component, (_properties: $component_properties));
Expand Down Expand Up @@ -159,7 +159,7 @@ $FRAMEWORK_SPACE_PLACE: ();
@return map-deep-get($FRAMEWORK_SPACE_PLACE, $name);
}

///
///
/// @group publicapi
@mixin create_subshape($name, $parent, $changes) {
@if not shape-exists($parent) {
Expand Down Expand Up @@ -279,7 +279,7 @@ $FRAMEWORK_SPACE_PLACE: ();
$context_selectors: settings("#{$name}:::_selectors");
@if is_error($context_selectors) {
@include error(error_message($context_selectors));
} @else {
} @else {
@each $selector in settings("#{$name}:::_selectors") {
$shape: get_root($subshape_name);
@each $component in map-deep-get($shape, _components) {
Expand Down Expand Up @@ -315,7 +315,7 @@ $FRAMEWORK_SPACE_PLACE: ();
}
} @else {
$old_value_set: map-deep-get($spent_keys, $key);
@if $value_set != enum('ValueSet:::OPTIONAL') and
@if $value_set != enum('ValueSet:::OPTIONAL') and
($value_set != enum('ValueSet:::REQUIRED') or $old_value_set == enum('ValueSet:::OPTIONAL')) {
@include error("Shape `#{$ancestor_name}` is not a proper shape due to `#{$key}`.");
}
Expand All @@ -327,4 +327,4 @@ $FRAMEWORK_SPACE_PLACE: ();
}
}
}
}
}
5 changes: 3 additions & 2 deletions styles/framework/settings/_init.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@use "sass:meta";
$FRAMEWORK_SETTINGS_MANIFEST_GLOBAL: ();
$FRAMEWORK_USED_SETTINGS: ();

Expand All @@ -21,9 +22,9 @@ $FRAMEWORK_USED_SETTINGS: ();
@debug "=== Clump Start ===";
@each $key, $value in flatten_keep_references($settings) {
@if map-get($already_defined, $key) {
@debug "~~#{$key} : #{$value}~~ (overridden above)";
@debug "~~#{$key} : #{meta.inspect($value)}~~ (overridden above)";
} @else {
@debug "#{$key} : #{$value}";
@debug "#{$key} : #{meta.inspect($value)}";
}
$already_defined: map-merge($already_defined, ($key: true));
}
Expand Down

0 comments on commit dc866ea

Please sign in to comment.