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

Feature request: Custom injection target #3

Open
m44rten1 opened this issue Nov 16, 2023 · 3 comments
Open

Feature request: Custom injection target #3

m44rten1 opened this issue Nov 16, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@m44rten1
Copy link

Hello,

First off, I'd like to express my appreciation for your work on the ShadowStyle plugin. However, I've encountered a scenario where being able to specify a custom injection target would greatly enhance its utility in my project.

My project involves lazy loading styles, and as a result, I don't inject them at the entry point. This leads to a need for more flexibility in terms of where the styles are injected. To address this, I propose adding an option to the ShadowStyle plugin that allows users to define a custom injection target.

Here's a rough idea of how this feature could be implemented:

...
plugins: [
  shadowStyle({ injectionTarget: 'my-injection-target' }),
],
...
@hood
Copy link
Owner

hood commented Nov 20, 2023

Hey, thank you for using the plug-in and providing this idea! What would the injection target refer to, in your example? A DOM node, or a placeholder string to swap with the actual output CSS?

@hood hood added the enhancement New feature or request label Nov 21, 2023
@m44rten1
Copy link
Author

m44rten1 commented Feb 2, 2024

Hey! I see that my comment wasn't clear. my-injection-target would refer to a file-name. I believe that the plugin only allows 'entry' files, if I understand the isInjectionTarget method.

@hood
Copy link
Owner

hood commented Apr 24, 2024

Yes, isInjectionTarget currently scans for output files and returns true if the file has the isEntry flag set by Vite. We can definitely customise this behaviour and allow for custom definition of an entrypoint.

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

No branches or pull requests

2 participants