Skip to content
Discussion options

You must be logged in to vote

Yes, though it requires some workarounds. Put it in your public folder, or, if it needs to be processed by Vite, make it an unlisted CSS entrypoint.

Then in your HTML pages, use a reference like href="/<path-to-style>.css" instead of use an alias or relative path.

In your content script, you'll have to add the CSS to the page manually by creating a link or style element yourself.

async onMount(uiContainer, shadow) {
  const url = browser.runtime.getURL('/<path-to-style>.css');
  const myStyles = document.createElement('style');
  const myStyle.textContent = await (await fetch(url)).text();
  shadow.querySelector('head').append(myStyles);

  // The rest of your code
}

There are several rea…

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@aklinker1
Comment options

@Tensai75
Comment options

@amitbeck
Comment options

@Tensai75
Comment options

@amitbeck
Comment options

Answer selected by Tensai75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants