Conversation
|
Deploy preview for docusaurus-2 ready! Built with commit 08308a0 |
|
It's strange, E2E tests fails, I missed something? |
|
Thanks @lex111 , we really need a way to share frontend code this way, not only to fix the existing issue, but also to expose less things to swizzle, and share common non-ui code with upcoming Bootstrap/tailwind themes. Unfortunately, it's not a very good time to work on this, as it's likely to conflict with my i18n branch. I think we should rather just use regular imports, and let the shared code emit its own TS typedefs instead, like a regular third-party TS package. We don't need users to swizzle content of this package: they can already swizzle the theme components that import from this package instead. Let's talk on Discord soon to discuss about all that |
|
I like this approach because we are dealing with an essentially
regular theme, so the user can swizzle any component of the base theme
(for example). It's pretty convenient and easy for users (and for us
as developers).
2020-11-16 17:14 GMT+03:00, Sébastien Lorber <notifications@github.com>:
… Thanks @lex111 , we really need a way to share frontend code this way, not
only to fix the existing issue, but also to expose less things to swizzle,
and share common non-ui code with upcoming Bootstrap/tailwind themes.
Unfortunately, it's not a very good time to work on this, as it's likely to
conflict with my i18n branch.
Also I'm not very fan of using too much webpack aliases everywhere, as it
makes the whole system more implicit and complex.
I think we should rather just use regular imports, and let the shared code
emit its own TS typedefs instead, like a regular third-party TS package.
We don't need users to swizzle content of this package: they can already
swizzle the theme components that import from this package instead.
Let's talk on Discord soon to discuss about all that
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#3752 (comment)
|
|
closing in favor of |
Motivation
Originally I actually wanted to fix #3747, for which I just created new webpack alias for theme utils (see first commit 16e09fc). However, then I realized that this is not a good solution in the long term. Thus, I have to came that we need to create new package for the common/shared/reusable parts of any Docusaurus theme.
Similar subject has already been raised in PR #2714. However, in current PR I am only moving the theme utils (mostly to resolve #3747), but this is good starting point for further work to split classic theme.
But, technically, I decided to do this via slightly different approach (opposite of #2714) - a really used theme (note, not preset) can have a base theme, i.e. it will be based on its components/hooks/etc. (Maybe it sounds a little confusing, and we need to think about the better naming/definition). In fact, base theme is essentially a regular plugin theme, which is give reusable parts for using in actual theme (and in subsequent themes too).
This functionality works in the case of using a preset (generally it is use case by default) and if only the theme is used (without preset). Since not everyone uses the classic preset, they can still use base theme's parts. I almost forgot: base/common theme adds webpack alias
theme-utils, I thought it would be handy for all us.It's more of a POC to show my whole idea. Perhaps the code needs to be improved or modified in some way (not a big deal, though).
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
Preview. And of course the command
yarn swizzle @docusaurus/theme-classic Footerruns without errors anymore.Related PRs
(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)