https://kotlinlang.org logo
#ktor
Title
# ktor
a

Arjan van Wieringen

02/28/2024, 6:03 PM
Just a tip for people trying to get Tailwind working in Ktor HTML templates. The out-of-the-box config works pretty much directly:
Copy code
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: {
      files: [
          './src/main/kotlin/**/*.kt', 
      ]
  },
  theme: {
    extend: {},
  },
  plugins: [],
}
And my code I have this kotlinx.html code:
Copy code
div("text-3xl font-bold underline") {
        h1("") { +title }

        article {
            p { +"This is a blog post" }
        }
    }
And it works with:
Copy code
npx tailwindcss -i src/main/resources/tailwind/input.css -o src/main/resources/tailwind/styles.css
I couldn't find anything on the webz, so I just tried it out.
🔥 2
73 Views