#Using Pre-made HTML/CSS/Javascript Elements in Electron

10 messages · Page 1 of 1 (latest)

remote shale
#

My message is too long so you can refer to this stack overflow post if it isn't already downvoted out of existence:
https://stackoverflow.com/questions/77855919/using-pre-made-html-css-javascript-elements-in-electron

Any helps is very appreciated!

naive magnet
#

Your question already has a close vote for "need more focus", but personally I'm tempted to vote close for "need details or clarity". I don't understand your question

remote shale
#

I will try to explain as best I can, but my terminology may be a bit off. As you know theres the main, preloader, and renderer js files. I want to learn how I can use other javascript files seperate from those that are linked to html elements being inserted into my index.js. When I pull an element I want to add off the internet, lets say a clock, it has its own html, css, and js. I inject the html from the clock into my index.html page. The clock html has links to its own css and js, but I dont think the js is being recognized or something. My question is why isnt the js that is linked in the injected clock html not working? Can I not add a link with a path and expect it to work? If not, where do I have to put the clock.js for it to work?

naive magnet
#

how do you 'inject"?

remote shale
#

If you look at that stack overflow post you can see the three differentt fucntions I have in my main/renderer/preloader js files. Essentially I just open up the html file and read in the html and send that to the innerhtml of my main page. within that html data i am sending, it has links to the css and js for that specific html element

naive magnet
#

look like a JS framework with extra steps

#

why not just using React or Angular or Vue, or anything else made for this?

remote shale
#

Do you have any recommendations on where I can go to get info on how to implement react with electron?

naive magnet
#

hmm, depends if you want to do the config yourself or use a premade stuff

#

For a complete premade config you can search for "React Electron Boilerplate" on Google. For a config with just a bundler, you can use a tool like electron-forge (official tool for Electron) or electron-vite for example, and then add React to it. For a full custom config, you can create a Vite project, add the react plugin to it and then read this. There are many other options of course, these are just suggestions.