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

[BUG] tailwindcss doesn't work in content script UI #953

Open
2 of 3 tasks
zshnb opened this issue Apr 22, 2024 · 4 comments
Open
2 of 3 tasks

[BUG] tailwindcss doesn't work in content script UI #953

zshnb opened this issue Apr 22, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@zshnb
Copy link

zshnb commented Apr 22, 2024

What happened?

I use antd and tailwindcss, this is my content script UI


export const config: PlasmoCSConfig = {
  matches: ["https://www.youtube.com/*"]
}

export const getInlineAnchor: PlasmoGetInlineAnchor = async () =>
  document.querySelector("#player")

const HOST_ID = "engage-csui"

export const getShadowHostId: PlasmoGetShadowHostId = () => HOST_ID
export const getStyle = () => {
  const style = document.createElement("style")
  style.textContent = antdResetCssText
  return style
}

export const mountShadowHost: PlasmoMountShadowHost = ({
  shadowHost,
  anchor,
  mountState
}) => {
  anchor.element.appendChild(shadowHost)
  mountState.observer.disconnect() // OPTIONAL DEMO: stop the observer as needed
}

export default function Toolbar() {
  return (
    <StyleProvider container={document.getElementById(HOST_ID).shadowRoot}>
      {
        showDownloadButton && (
          <Flex gap={'middle'} className={'ml-4'}>
            <Button type={'text'} shape={'circle'} icon={<Video/>} onClick={() => handleDownloadVideo()} loading={videoLoading}/>
            <Button type={'text'} shape={'circle'} icon={<Images size={18}/>} onClick={handleDownloadThumbnail} loading={thumbnailLoading}/>
            <Button type={'text'} shape={'circle'} icon={<Captions/>} onClick={() => handleDownloadSubtitle('text')} loading={subtitleLoading}/>
          </Flex>
        )
      }
    </StyleProvider>
  )
}

I add ml-4 in Flex component, but I didn't see the effect.
image
image
image

Version

Latest

What OS are you seeing the problem on?

No response

What browsers are you seeing the problem on?

No response

Relevant log output

No response

(OPTIONAL) Contribution

  • I would like to fix this BUG via a PR

Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I checked the current issues for duplicate problems.
@zshnb zshnb added the bug Something isn't working label Apr 22, 2024
@karthest
Copy link

What is your antdResetCssText ?
Does it contains

@tailwind base;
@tailwind components;
@tailwind utilities;

?

@zshnb
Copy link
Author

zshnb commented Apr 25, 2024

What is your antdResetCssText ? Does it contains

@tailwind base;
@tailwind components;
@tailwind utilities;

?

yes, but I removed @tailwind base

@karthest
Copy link

Did you set prefix in tailwind.css.js ?

What is your antdResetCssText ? Does it contains

@tailwind base;
@tailwind components;
@tailwind utilities;

?

yes, but I removed @tailwind base

Did you set prefix in tailwind.config.js ?

@zshnb
Copy link
Author

zshnb commented Apr 25, 2024

Did you set prefix in tailwind.css.js ?

What is your antdResetCssText ? Does it contains

@tailwind base;
@tailwind components;
@tailwind utilities;

?

yes, but I removed @tailwind base

Did you set prefix in tailwind.config.js ?

no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants