Last active
November 6, 2025 02:28
-
-
Save nickpreston24/048ef5cba257597de33c822606f1e2cc to your computer and use it in GitHub Desktop.
Remove raw JS footguns by example.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Document</title> | |
| <!-- Tailwind + DaisyUI --> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <script> | |
| tailwind.config = { | |
| theme: { | |
| extend: { | |
| colors: { | |
| primary: '#38bdf8', | |
| secondary: '#818cf8', | |
| accent: '#22d3ee', | |
| neutral: '#1e293b', | |
| } | |
| } | |
| }, | |
| plugins: [daisyui], | |
| } | |
| </script> | |
| <link href="https://cdn.jsdelivr.net/npm/daisyui@4.12.10/dist/full.min.css" rel="stylesheet" type="text/css"/> | |
| <!-- HTMX + Alpine --> | |
| <script src="https://unpkg.com/htmx.org@2.0.3"></script> | |
| <script src="https://unpkg.com/alpinejs@3.14.0" defer></script> | |
| </head> | |
| <body> | |
| <h1 x-data="{ message: 'I ❤️ Alpine' }" x-text="message"></h1> | |
| <div x-data="{ hasBorder: false }"> | |
| <div :class="{ 'hover:border-blue-500 border-2 border-red-500': hasBorder }" class="p-4 bg-gray-100"> | |
| This div's border will toggle. | |
| </div> | |
| <button @click="hasBorder = !hasBorder" class="mt-4 px-4 py-2 bg-blue-500 text-white rounded"> | |
| Toggle Border | |
| </button> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment