Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unified configs for the project styles + theme.json + t2.json #353

Closed
Sisanu opened this issue Jan 17, 2022 · 2 comments
Closed

Unified configs for the project styles + theme.json + t2.json #353

Sisanu opened this issue Jan 17, 2022 · 2 comments
Labels
CSS enhancement New feature or request question Further information is requested

Comments

@Sisanu
Copy link
Contributor

Sisanu commented Jan 17, 2022

When trying to sync the theme.json, the theme CSS, and t2.json files there are a few gaps we could solve by defining some global variables that would correlate all in a unified way. We could use something like this in the base theme.

:root {
	--theme-spacing-horizontal: 2rem;
	--theme-content-width: min(30rem, calc(100vw - 2 * var(--theme-spacing-horizontal)));
	--theme-wide-width: min(75rem, calc(100vw - 2 * var(--theme-spacing-horizontal)));
	--theme-max-full-width: 1440px; /* When zooming out, the content should not overflow this maximum size. */
}

.site-container,
.alignwide {
	margin: 0 auto;
	max-width: var(--theme-wide-width);
	width: 100%;
}

.entry-content > .alignfull {
	max-width: var(--theme-max-full-width);
}

In the theme.json the WordPress native sizes can be set like this:

{
	...
	"settings": {
		"layout": {
			"contentSize": "var(--theme-content-width)",
			"wideSize": "var(--theme-wide-width)"
		}
	}
	...
}

For the t2.json file, we could use some default settings that would inherit the theme config too. Not sure what to use from T2 at this point, if there is anything clearly documented. There is one mention about something that seems related to this https://github.com/DekodeInteraktiv/T2/issues/991

Basically, we could have a single place where we are defining the theme specifics, and the theme.json + t2.json could inherit these without the need to recompute/identify additional variables to override, etc.

In my opinion, the theme variables should be the driver, and the theme.json and t2 to inherit available values if defined (like t2 should only fall back when the theme variable is not set, but the theme should not rely on t2 variables). Any thought on this?

@Sisanu Sisanu added CSS enhancement New feature or request question Further information is requested labels Jan 17, 2022
@Sisanu Sisanu changed the title Unified configs for the project + theme.json + t2.json styles Unified configs for the project styles + theme.json + t2.json Jan 17, 2022
@stian-overasen
Copy link
Member

It this issue still relevant @Sisanu ?

@Sisanu
Copy link
Contributor Author

Sisanu commented Oct 1, 2024

@stian-overasen, I don't think so. It's been more than 2 years since the issue was posted, and in the meanwhile, we switched to theme.json as the driver, which is even better. Please close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants