honkit icon indicating copy to clipboard operation
honkit copied to clipboard

New default theme

Open azu opened this issue 5 years ago • 8 comments

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

azu avatar Jun 22 '20 06:06 azu

  • [ ] OGP Support
  • [ ] GitHub page link #116

azu avatar Aug 26 '20 03:08 azu

Should use the prefers-color-scheme media query to set the default color scheme via CSS

symbiogenesis avatar Apr 15 '22 15:04 symbiogenesis

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

azu avatar Jul 31 '23 12:07 azu

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 avatar Aug 28 '23 06:08 jeffrey-ng

@jeffrey-ng Please note that this is still experimental and therefore quite unstable. (Probably Breaking changes are also made in the PATCH version.)

  1. install theme
npm @honkit/honkit-plugin-theme -D
  1. change plugins in book.json
plugins: ["-theme-default", "-search", "-lunr", "-fontsettings", "@honkit/honkit-plugin-theme"]
  • https://github.com/honkit/honkit/blob/d058ddfcd0837af110c9f2d49f612bc0b75390b4/book.js#L11

azu avatar Aug 28 '23 07:08 azu

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.

jeffrey-ng avatar Aug 28 '23 14:08 jeffrey-ng

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

azu avatar Aug 28 '23 23:08 azu

Pagefind is suitable for new search engine.

azu avatar Jan 17 '24 08:01 azu