Code Monkey home page Code Monkey logo

Comments (9)

reducm avatar reducm commented on September 25, 2024 4

found the docs said The entries of options and popup pages are HTML files, their outputs are same as nomarl page. link

its not a good solution that can import css as string, an then add to the document

such as I used the element-plus, in your main.ts

import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import cssString from 'element-plus/dist/index.css'


const style = document.createElement('style');
document.head.append(style);
style.textContent = cssString;

createApp(App).use(ElementPlus).mount('#app')

from vite-plugin-chrome-extension.

Benbinbin avatar Benbinbin commented on September 25, 2024 1

@boka18 sorry, I can't find a solution by using this plugin. Now I change the plugin to this one and it works fine. The developer also provides a template to build extension with vite+vue+manifestV3.

from vite-plugin-chrome-extension.

boka18 avatar boka18 commented on September 25, 2024

Hey @Benbinbin, I have the exact same issue. Were you able to resolve it somehow?

from vite-plugin-chrome-extension.

boka18 avatar boka18 commented on September 25, 2024

got it @Benbinbin! thank you!

I was also able to create starter template for react (with this plugin)

You can check out the boilerplate here:
https://github.com/boka18/vite-react-chrome-extension-example

It's forked from here:
https://github.com/alvarosaburido/vite-vue-chrome-extension-example
In the above repo, it was built for vue. I managed to port that to react

from vite-plugin-chrome-extension.

tyanbiao avatar tyanbiao commented on September 25, 2024

same issue

from vite-plugin-chrome-extension.

ciricc avatar ciricc commented on September 25, 2024

I have the same problem with windicss import 'virtual:windi.css' in Svelte application popup. Css generates, but not link into HTML correctly

from vite-plugin-chrome-extension.

ciricc avatar ciricc commented on September 25, 2024

@reducm Thank you, that's worked for me

from vite-plugin-chrome-extension.

evanb2 avatar evanb2 commented on September 25, 2024

@reducm I'm not using ElementPlus, but after adding the other parts of your solution I'm still not getting Tailwind imported. When I inspect the popup DOM I don't see the <style> element. Is ElementPlus adding some functionality for this to work for you?

from vite-plugin-chrome-extension.

reducm avatar reducm commented on September 25, 2024

@reducm I'm not using ElementPlus, but after adding the other parts of your solution I'm still not getting Tailwind imported. When I inspect the popup DOM I don't see the <style> element. Is ElementPlus adding some functionality for this to work for you?

to my knowledge, the elementPlus css is just some css string, and I found it did add en style tag to the document head

image

i think maybe some js code overwrite it, you code just use this code(remove other import) to see is there a style tag in head

import cssString from 'someCss'


const style = document.createElement('style');
document.head.append(style);
style.textContent = cssString;

from vite-plugin-chrome-extension.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.