Skip to content
New issue

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

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

Already on GitHub? # to your account

Move CSS to a @layer #2782

Closed
hesxenon opened this issue Nov 25, 2024 · 1 comment
Closed

Move CSS to a @layer #2782

hesxenon opened this issue Nov 25, 2024 · 1 comment
Milestone

Comments

@hesxenon
Copy link

Search Terms

css layer

Problem

Currently it's kinda "hard" to override styles in custom css, especially if you want to include your own libraries in typedoc.

Suggested Solution

wrapping all css declarations in a

@layer typedoc {
  /* typedoc styles */
}

so that consumers can do

@layer my-library, typedoc;

Current workaround

// plugin.js
export function load(
 /**
  * @type import("typedoc").Application
  */
  app
) {
  app.renderer.hooks.on("head.end", (ctx) =>
      JSX.createElement(JSX.Raw, {
        html: `<script async>document.head.querySelector('link[href*="style.css"]').remove()</script>`,
      }),
  );
}

with

/* custom.css */
@import url("style.css") layer(typedoc);
@layer my-library, typedoc;

and

{
  "$schema": "https://typedoc.org/schema.json",
  "customCss": "custom.css",
  "plugin": ["plugin.js"],
}
@hesxenon hesxenon added the enhancement Improved functionality label Nov 25, 2024
@Gerrit0
Copy link
Collaborator

Gerrit0 commented Nov 26, 2024

Easy enough of a change to do, TIL about @layer!

@Gerrit0 Gerrit0 added this to the v0.27.0 milestone Nov 26, 2024
@Gerrit0 Gerrit0 removed the enhancement Improved functionality label Feb 2, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants