New default theme
We consider to new default theme.
Probably, @honkit/honkit-plugin-theme-default(current theme) is still existing in the future for compatiblity.
We want to opt-in new default theme. It is probably a mechanism that is enabled by adding some settings to book.json.
Releated idea: label:"Type: Theme"
Purpose
- Fast
- Stable
- Extensible
Changes from current default theme
- Reduce Cumulative Layout Shift #91
- Remove Sidebar layout storage
- Remove Font Settings
- Rendering as server-side, less client-side rendering
- Reduce library like jQuery
- But plugins depend on jQuery...
- Reduce dependency
- Remove font-awesome #132
- Use
<a>link instead of Pjax
TODO
- [ ] Built-in Search
- [ ] Plugin Compatibility
- It will probably never be fully compatible. It will provide alternative functions.
- [ ] Opt-in Switch
- [ ] Async Loading for INP
- [ ] View Transition API support?
Usage
- See https://github.com/honkit/honkit/issues/57#issuecomment-1695168706
- [ ] OGP Support
- [ ] GitHub page link #116
Should use the prefers-color-scheme media query to set the default color scheme via CSS
We have added @honkit/honkit-plugin-theme as experimental.
https://honkit.netlify.app/ it-self use this theme.
- https://github.com/honkit/honkit/pull/365
This is WIP. This PR has removed all but what is necessary. As a results,
- JS: 50kb + 50kb → 1.6kb
- CSS: 10kb + 2kb → 4kb+2kb
TODO
- Search Plugin
- Use CSS Variables
- Probably, drop to use less
- Think plugin systems
- Import maps will be suitable to this situation, I think
- Support Async Plugin Loading
- Island Architecture guideline
Was wondering if you had some pointers on how one could test this theme out on their own honkit setup?
I'm looking to removing the jquery dependency as I'm running into some CSP issues with the default theme.
@jeffrey-ng Please note that this is still experimental and therefore quite unstable. (Probably Breaking changes are also made in the PATCH version.)
- install theme
npm @honkit/honkit-plugin-theme -D
- change
pluginsinbook.json
plugins: ["-theme-default", "-search", "-lunr", "-fontsettings", "@honkit/honkit-plugin-theme"]
- https://github.com/honkit/honkit/blob/d058ddfcd0837af110c9f2d49f612bc0b75390b4/book.js#L11
Please note that this is still experimental and therefore quite unstable.
100% understand.
Assuming this should be npm install @honkit/honkit-plugin-theme -D?
Had tried this originally but doesn't look like the package is published publicly.
✗ npm install @hontkit/hontkit-plugin-theme -D
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@hontkit%2fhontkit-plugin-theme - Not found
npm ERR! 404
npm ERR! 404 '@hontkit/hontkit-plugin-theme@*' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
Ah, I forgot to publish to npm.
I've published @honkit/honkit-plugin-theme to npm.
https://github.com/honkit/honkit/releases/tag/v5.1.0
Pagefind is suitable for new search engine.