samrum / vite-plugin-web-extension

A vite plugin for generating cross browser platform, ES module based web extensions.
MIT License
331 stars 32 forks source link

Question: How to compile `content_scripts.css`? #74

Closed lemonadee71 closed 1 year ago

lemonadee71 commented 1 year ago

I have this in my config

    content_scripts: [
      {
        matches: ['https://*.youtube.com/*'],
        js: ['src/inject.js'],
        css: ['src/inject.css'],
      },
    ],

And I have a tailwind css file

/* inject.css */
@tailwind base;
@tailwind components;
@tailwind utilities;

I expect the inject.css to be compiled but it is only copy pasted into dist/src. Is this possible? I'm new to vite and web extensions.

aleksolutions commented 1 year ago

I would love to have this feature also, because when you are not using shadowDOM the styles loads much faster this way.

samrum commented 1 year ago

Opened a PR for an implementation of this that will forward content script css files as inputs to Vite. I tested it with some simple css, css with tailwind loaded in it like your example, and scss files and it seemed to work alright.

lemonadee71 commented 1 year ago

Thanks! Will wait for it to be merged then