Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Tailwind in content scripts doesn't work #16

Open
KULTI1995 opened this issue Mar 25, 2023 · 3 comments
Open

Tailwind in content scripts doesn't work #16

KULTI1995 opened this issue Mar 25, 2023 · 3 comments

Comments

@KULTI1995
Copy link

KULTI1995 commented Mar 25, 2023

  1. Does not generate tailwinds in content scripts. Styles don't load at all.
  2. Manifest generation in build.ts does not work, how to solve:
  const fullPath = relative(
    extDir,
    resolve(pageDir, pageFile)
  )

  return fullPath.replace('\\', '/')
  1. Tailwind on different pages will generate different problems when we don't use shadowDom. Therefore styles should be generated as a separate file. Like here:
import { createRoot } from 'react-dom/client';
import Main from './Main';

const container = document.createElement('div')
const rootEl = document.createElement('div')
const styleEl = document.createElement('link')
const shadowDOM = container.attachShadow?.({ mode: 'open' }) || container
styleEl.setAttribute('rel', 'stylesheet')
styleEl.setAttribute('href', chrome.runtime.getURL('contentStyle.css'))
shadowDOM.appendChild(styleEl)

shadowDOM.appendChild(rootEl)
document.body.appendChild(container)

const root = createRoot(container); // createRoot(container!) if you use TypeScript
root.render(<Main/>);
  1. css modules in content scripts do not work.
@Debdut
Copy link
Owner

Debdut commented Apr 22, 2023

Thanks, for reporting, it's a problem in content script, we'll fix it in next iteration.

@chenyusheng
Copy link

I have encountered this problem, too. Is there a good solution?

@tluthra
Copy link

tluthra commented Feb 15, 2024

I'm running into the same issue, any help on getting Tailwind to work would be great

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants