Skip to content

fix: convert typography overrides to design tokens#41

Merged
arbrandes merged 1 commit intoopenedx:masterfrom
arbrandes:change-typography-take-2
Apr 2, 2026
Merged

fix: convert typography overrides to design tokens#41
arbrandes merged 1 commit intoopenedx:masterfrom
arbrandes:change-typography-take-2

Conversation

@arbrandes
Copy link
Copy Markdown
Contributor

@arbrandes arbrandes commented Apr 2, 2026

Description

Paragon v23+ resolves styles via CSS custom properties generated from JSON design tokens, not SCSS variables. The previous SCSS-only approach in _variables.scss had no effect on Paragon components.

This PR adds a typography.json token file under paragon/tokens/core/global/, uncomments the @use import in core.scss so the brand's core.css includes the built variables, and adds a prepack script so dist/ is generated before npm publish.

Test report

This has been tested to be working with frontend-app-learner-dashboard. (By manually copying over the brand-openedx dist to node_modules, because apparently module.config.js doesn't work with design token stuff.)

LLM usage notice

Built with assistance from Claude.

As of Paragon v23 we're using design tokens, so convert the typography
changes introduced in the previous commit accordingly.

Also add a prepack script so that CSS is guaranteed to be built before
npm publish.

Co-Authored-By: Claude <noreply@anthropic.com>
@arbrandes arbrandes force-pushed the change-typography-take-2 branch from 2da1ff0 to 03f5a34 Compare April 2, 2026 13:31
Copy link
Copy Markdown
Contributor

@brian-smith-tcril brian-smith-tcril left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pulled this branch and did a spot check on a few of the generated css vars.

LGTM!

One overall question: is the brand package where these values should live? If these are intended to be "defaults" then should they live in Paragon base styles instead?

Comment thread paragon/core.scss
// this file creates the core.css import here all the common styles for your theme.

// @use "./build/core/variables";
@use "./build/core/variables";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified that without this we get nothing in dist/core.css, but with this we get the proper typography values.

@edx/elm-theme handles this differently, but this feels correct.

Copy link
Copy Markdown
Contributor

@e0d e0d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for making it actually work ;)

@arbrandes arbrandes merged commit 469cdf5 into openedx:master Apr 2, 2026
2 checks passed
@arbrandes arbrandes deleted the change-typography-take-2 branch April 2, 2026 15:24
@openedx-semantic-release-bot
Copy link
Copy Markdown

🎉 This PR is included in version 2.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@arbrandes
Copy link
Copy Markdown
Contributor Author

@brian-smith-tcril

is the brand package where these values should live?

A very valid question. For now, I think it's defensible to have it in here because:

  1. Paragon's typography defaults are straight off of Bootstrap; it would be an arguably more surprising change to have these changes (which include a custom font) in there, than here
  2. Having an actual set of tokens in this repo gives users a working example

I do agree with what you brought up elsewhere: that what we actually want operators to do is load their CSS at runtime from somewhere else, and making this change here can be seen as counter to that. However, as we also discussed earlier, this particular conundrum should probably be fixed in documentation, anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants