marco-prontera / vite-plugin-css-injected-by-js

A Vite plugin that takes the CSS and adds it to the page through the JS. For those who want a single JS file.
MIT License
429 stars 26 forks source link

Feature request: Use globby-like patterns in scanEntries #102

Closed SetupCoding closed 1 year ago

SetupCoding commented 1 year ago

I would love to be able to use globby-like patterns with the scanEntries function, to cover specific folder structures e.g.

root/
├─ src/
│   ├─ components/
│   │   ├─ componentA/
│   │   │  ├─ componentA.tsx
│   │   │  ├─ componentA.module.scss
│   │   │  ├─ componentA-utils.ts
│   │   ├─ componentB/
│   │   │  ├─ componentB.tsx
│   │   │  ├─ componentB.module.scss
│   │   │  ├─ componentB-utils.ts
...
entry: {
  index: libEntryPoint,
  ...scanEntries('src/components/**/*.tsx'),
},

Is that something that might be planned in the future?

Many thanks in advance!

marco-prontera commented 1 year ago

Hi @SetupCoding, I'd like to understand a little more about the purpose of this feature. Can you explain a little more specifically about this use case please?

marco-prontera commented 1 year ago

Hi @SetupCoding , you could try the relativeCSSInjection option (configure it to true), this will inject the relative css code inside the relative entry point. I will close this issue, if there is something other or the option I said isn't enough we can reopen it with no problem, thank you in advance!