Electron
Electron is a framework for building cross-platform desktop applications with web technologies.

Install daisyUI for Electron

How to install Tailwind CSS and daisyUI in a Electron project

1. Create a new Node project

Initialize a new Node project

entry pointshould bemain.js

Terminal
mkdir myapp
cd myapp
npm init

Run this command to add the required scripts to yourpackage.json

Terminal
npm pkg set scripts.start="electron ."
npm pkg set scripts.build:css="tailwindcss -i src/input.css -o public/output.css"

2. Install Electron, Tailwind CSS, and daisyUI

Terminal
npm install electron tailwindcss@latest @tailwindcss/cli@latest daisyui@latest

3. Create files

Create amain.jsat the root of your project with the following content

main.js
const { app, BrowserWindow } = require('electron')

const createWindow = () => {
  const win = new BrowserWindow()
  win.loadFile('src/index.html')
}

app.whenReady().then(() => {
  createWindow()
})

Create asrc/index.htmlfile with the following content

src/index.html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
    <meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self'">
    <link rel="stylesheet" type="text/css" href="../public/output.css">
  </head>
  <body>
    <button class="btn">Hello daisyUI</button>
  </body>
</html>

Create asrc/input.cssfile with the following content

src/input.css
@import "tailwindcss";
@plugin "daisyui";

3. Build the CSS and run the project

Terminal
npm run build:css
npm start

Now you can use daisyUI class names!

Do you have a question? Ask on GitHub or Discord server
Do you like daisyUI? Post about it!
Support daisyUI's development: Open Collective
daisyUI store

NEXUS
Official daisyUI Dashboard Template

Available on daisyUI store

More details
OSZAR »