Use TailwindCSS classe in your Djula templates without any JavaScript or Node.js tooling
Create a new Caveman project
(ql:quickload :caveman2)
(caveman2:make-project #P"~/quicklisp/local-projects/cl-tw-demo")
- Add
cl-djula-tailwind
as system dependency
Add a placeholder for the stylesheet in the default template templates/layouts/default.html
<style>{{ tailwind | safe }}</style>
Define a new function called render-stylesheet
in src/web.lisp
(defun render-stylesheet (template)
(setf (getf djula:*default-template-arguments* :tailwind) (cl-djula-tailwind:get-stylesheet template *template-directory*)))
Call this function in your routes with the template name as the argument
(defroute "/" ()
(render-stylesheet #P"index.html")
(render #P"index.html"))
You can install it from quicklisp
(ql:quickload :cl-djula-tailwind)
- Rajasegar Chandran
Copyright (c) 2022 Rajasegar Chandran