-
-
Notifications
You must be signed in to change notification settings - Fork 695
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
Load a theme via a theme
key in volto.config.js
or in package.json
#4625
Conversation
✅ Deploy Preview for volto ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
addon-registry.js
Outdated
@@ -130,6 +130,10 @@ class AddonConfigurationRegistry { | |||
this.packages = {}; | |||
this.customizations = new Map(); | |||
|
|||
// Theme from a package.json key or from volto.config.js | |||
// Programatically via volto.config.js wins | |||
this.theme = packageJson.theme || this.voltoConfigJS.theme; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might want an addon to provide the theme.
The volto.config.js implies that the project is no longer throw-away, or at least there's a standard "distribution-like" volto.config.js that I use in all my projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that would be desirable, but the current state is that you need to define the enabled addons
list in volto.config.js
or in package.json
anyways, so adding the theme
is nothing that we "loose"...
In fact, these (addons and theme) are the only things that you need to "save" in order of a project to be expendable. Same applies for the dockerized approach... as long as you have a volto.config.js
that you can forward to your expendable project, you are safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add an option to define a theme name from an environment var. We have it already for addons iirc, so it would be a nice complement, and a very very nice addition for docker users :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a bunch of grammar and spelling fixes.
here's my ideal scenario:
Other then that, I love it! Thanks for working on this! |
Co-authored-by: Steve Piercy <web@stevepiercy.com>
@stevepiercy thanks for the review! Thanks for bearing with me! Yesterday I was not specially tuned for documenting, and the subject was not easy either. |
@tiberiuichim I see, yeah, we could iterate over it, by all means! Right now, this implementation was one that made sense to me. The main goal is for people not having to paste a recipe in their add-ons and then the entry points... /cc @plone/volto-team let me know if you are fine with this and we all agree with merging it. |
theme
key in volto.config.js
or in package.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more round, and I think we're good on the docs.
Co-authored-by: Steve Piercy <web@stevepiercy.com>
I guess discard is ok Co-authored-by: Steve Piercy <web@stevepiercy.com>
addon-registry.js
Outdated
@@ -130,6 +130,10 @@ class AddonConfigurationRegistry { | |||
this.packages = {}; | |||
this.customizations = new Map(); | |||
|
|||
// Theme from a package.json key or from volto.config.js | |||
// Programatically via volto.config.js wins | |||
this.theme = packageJson.theme || this.voltoConfigJS.theme; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add an option to define a theme name from an environment var. We have it already for addons iirc, so it would be a nice complement, and a very very nice addition for docker users :)
…n. Improve docs for `!default` SCSS keyword
@stevepiercy I made a few last time amendments, do you mind take a final look? |
Please integrate theme.md in docs/addons/index.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See suggestions.
docs/source/addons/theme.md
Outdated
3. Declare the theme as an add-on by adding its name as the value for the `addons` key in either `volto.config.js` or `package.json`. | ||
4. After starting Volto, the theme should be active. | ||
Now you can add overrides to the default theme in `src/theme`, same as you would in a project. | ||
5. Now you can safely delete your project's `theme` folder, since the one in the add-on will take precedence. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why should I delete the theme folder of the project. I want to use the theme, but use a different font.
Can I customize with src/theme/extras/custom.overrides for example heading sizes and fonts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that we could state better the history behind the add-on themes and why after this, you don't need a project theme anymore (since only one is active at the same time). Effectively you are moving the theme from the project to an add-on, with all its consequences, so now your theme lives there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "only one (theme) is active at the same time" needs explanation.
The naive understanding of a theme is just the collection of some CSS rules, maybe variables. But here you mean what exactly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "only one (theme) is active at the same time".
The naive understanding of a theme is just a collection of CSS rules and maybe variables. How would you explain that thing that is the only one activated?
docs/source/addons/theme.md
Outdated
Now you can add overrides to the default theme in `src/theme`, same as you would in a project. | ||
5. Now you can safely delete your project's `theme` folder, since the one in the add-on will take precedence. | ||
|
||
## Using your own escape hatch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe start with a first line about why and when a hatch is needed. From an integrater point of view, without having built multiple themes before.
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Co-authored-by: Katja Süss <k.suess@rohberg.ch>
Co-authored-by: Katja Süss <k.suess@rohberg.ch>
@ksuess I amended here and there, please take a look. Also always when we talk about a theme, is as in a Volto Semantic UI theme. It's true that we are overloading the term, here and there. Maybe it does need more rework. |
I'm not able to outsource a simple (very simple) theme. For getting familiar with this topic, I set up a vanilla project and a simple add-on and followed the first section of addons/theme.md. But do not see the theme add-on customizations. |
Ah, OK, so it's the theme.config that is THE theme. The Semantic UI theme. |
@ksuess it does work here like a charm! Not with the custom CSS you tried (the breadcrumbs). But:
Works well. Also, did you The breadcrumb one should have been :)
|
[EDIT] With a fresh set up, this is now OK for me. Thank you. |
|
||
You can see an example of such a theme in: https://github.com/kitconcept/volto-light-theme | ||
|
||
## Modify a custom theme from another add-on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still not clear to me, what part of this section are instructions for the reusable theme, and which instructions belong to the add-on which slightly customizes the theme.
I stop bothering now, as I planned to take some days of from yesterday on.
Thanks for the clarifications so far. I'll come back with questions later, like: "How would I use a reusable theme like kitconcept/volto-light-theme, but with another text color (probably $text-color ? But where? /theme/custom/_main.scss ?)"
A first try, wich is not OK so far: https://github.com/rohberg/project-with-theme
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah no worries, thanks for the valuable feedback! We will continue developing this and the story behind, and improving docs. The plan to work on this and the future of theming in Volto during Beethoven Sprint.
…on` (#4625) Co-authored-by: Steve Piercy <web@stevepiercy.com> Co-authored-by: Katja Süss <k.suess@rohberg.ch>
@sneridagh do you know if it is possible to put the public folder in an addon, as is done with the theme? See: #4654 |
* master: (22 commits) Release changelog notes for 16.20.1 Release 17.0.0-alpha.5 Generate a split sitemap (also fix robots.txt) (#4639) Fix search block in edit mode re-queries multiple blocks with an empty search text (#4694) Fix Move to top of folder ordering in folder content view (#4691) Changelog Revert "Add current page parameter to the route in the listing and search block pagination (#4159)" (#4695) Release generate-volto 7.0.0-alpha.4 Force the resolution of the `react-error-overlay` package to `6.0.9` (#4687) Fix training links (#4635) Release 17.0.0-alpha.4 Release changelog notes for 16.20.0 (#4684) Update to latest backend versions (#4682) Support RelationList field with StaticCatalogVocabulary and SelectWidget. (#4614) Load a theme via a `theme` key in `volto.config.js` or in `package.json` (#4625) docs: improve creating view documentation (#4636) fix sitemap.xml.gz is not compressed #4622 (v2) (#4663) Make URL a literal string to fix broken link (#4667) Move developer guidelines to contributing #4665 (#4666) Update Volto contributing to align with and refer to the new Plone co… (#4634) ...
No description provided.