Skip to content

[BB-7542] feat: allow specifying scss overrides via dictionaries

Description

When it is required to build many different themes based on the edx-simple-theme, usually all of the would be configured via SCSS variables that are passed to them before the build process. Quite often, many of the variables between the themes are the same, so there is a need to be able to reuse them to reduce duplication. This MR changes how the SIMPLE_THEME_SCSS_OVERRIDES can be defined to allow reusing common overrides.

The changes allow us to edit the overrides easier, and also leverage dictionary merging defined by YAML specification to reuse common overrides, which is not possible with lists. E.g.:

COMMON_THEME_SCSS_OVERRIDES: &COMMON_THEME_SCSS_OVERRIDES
  bg-color: "#000000"
CUSTOM_THEME_SCSS_OVERRIDES: &CUSTOM_THEME_SCSS_OVERRIDES
  color: "#FFFFFF"
SIMPLE_THEME_SCSS_OVERRIDES:
  <<: CUSTOM_THEME_SCSS_OVERRIDES
  <<: COMMON_THEME_SCSS_OVERRIDES

The order in which the SCSS variables are defined is important, since SCSS doesn't have variable hoisting. This is important when one variable relies on the value of another one, e.g.:

$a: 42px;
$b: $a;

For that reason, the sorting of the keys on YAML dump has been disabled. Otherwise it messes up the order.

The MR makes changes in the backwards compatible way, i.e. if the overrides are define via YAML lists, it will still work. However in the future version, once OCIM and other configurations have been updated to use dicts, the backwards compatibility is going to be removed.

Supporting information

BB-7542

MR for updating grove-template

Testing instructions

This has been tested on client's dev instance. Example configuration.

Dependencies

List the dependencies required for this change, if any. Do not forget to link grove-template merge request here if that's affected by this change.

Checklist

If any of the items below is not applicable, do not remove them, but put a check in it.

  • All providers include the new feature/change
  • All affected providers can provision new clusters
  • Unit tests are added/updated
  • [-] Documentation is added/updated - will be updated in BB-7718
  • The TOOLS_CONTAINER_IMAGE_VERSION in ci_vars.yml is updated
  • The grove-template repository is updated

Additional context

Add any other context about the merge request here.

Edited by Maxim Beder

Merge request reports