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

getStyle: PlasmoGetStyle api unable to get live-reload effect. #949

Open
2 of 3 tasks
deng232 opened this issue Apr 18, 2024 · 4 comments
Open
2 of 3 tasks

getStyle: PlasmoGetStyle api unable to get live-reload effect. #949

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

Comments

@deng232
Copy link

deng232 commented Apr 18, 2024

content.tsx:

import styleText from  "data-text:./styles.css"
import type { PlasmoGetStyle } from "plasmo"
function Overlay(){
    return (
        <div className="overlay">
                Test
        </div>
    )
}
export const getStyle: PlasmoGetStyle = () => {
    const style = document.createElement("style")
    style.textContent = styleText
    return style
  }

export default Overlay

when styles.css update, there is extension re-packaged message show, but no effect on "overlay" unless reload extension.

Version

Latest

What OS are you seeing the problem on?

Windows

What browsers are you seeing the problem on?

Chrome

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.
@deng232 deng232 added the bug Something isn't working label Apr 18, 2024
@Jonathan-Asher
Copy link

Facing same issue...
Also for content scripts there is no HMR, the whole page just reload (and the extension as well)

Changing CSS/SCSS does not trigger the reload.

I belive related: #610 (comment)

@Jonathan-Asher
Copy link

Started using Tailwind CSS for the hot reloading!

@HeathStratosphere
Copy link

@Jonathan-Asher Would you mind detailing a bit of your process? I'd love to get some sort of HMR running for styles, and I've run into this same issue.

@Jonathan-Asher
Copy link

Jonathan-Asher commented Oct 24, 2024

@Jonathan-Asher Would you mind detailing a bit of your process? I'd love to get some sort of HMR running for styles, and I've run into this same issue.

Try going through this article:
https://docs.plasmo.com/quickstarts/with-tailwindcss

function Component(props: any) {
  return <div className='flex flex-col'> // Style the component with tailwind classes
    ...
  </div>
}

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

3 participants