guocaoyi / create-chrome-ext

🍺 Scaffolding your Chrome extension! Boilerplates: react \ vue \ svelte \ solid \ preact \ alpine \ lit \ stencil \ inferno \ vanilla
MIT License
1.64k stars 118 forks source link

tailwindcss #80

Closed qleml closed 5 months ago

qleml commented 6 months ago

I know this is not an issue but was someone able to add tailwindcss for react? if yes how? Thanks!!

brian7989 commented 5 months ago

Yes, I was able to.

  1. Run npm install -D tailwindcss postcss autoprefixer

  2. Run npx tailwindcss init -p

  3. Set tailwind.config.js as

    /** @type {import('tailwindcss').Config} */
    export default {
    content: [
    "./index.html",
    "./src/**/*.{js,ts,jsx,tsx}",
    ],
    theme: {
    extend: {},
    },
    plugins: [],
    }
  4. Add the following in index.css inside the component you are working with (ex: index.css inside /popup)

    @tailwind base;
    @tailwind components;
    @tailwind utilities;
  5. Start using TailwindCSS

    <h1 className="text-3xl font-bold underline">
    Hello world!
    </h1>

Linking official guide from TailwindCSS as reference here

swapnawebdev commented 5 months ago

How to work out in content script folder