Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rajasegar/cl-djula-tailwind

Tailwind classes for Djula templates
https://github.com/rajasegar/cl-djula-tailwind

common-lisp djula hacktoberfest hacktoberfest-accepted lisp tailwindcss

Last synced: 13 days ago
JSON representation

Tailwind classes for Djula templates

Awesome Lists containing this project

README

        

* cl-djula-tailwind

[[https://github.com/rajasegar/cl-djula-tailwind/workflows/CI/badge.svg]]
[[http://quickdocs.org/badge/cl-djula-tailwind.svg]]
[[https://img.shields.io/badge/license-MIT-blue.svg]]


Use [[https://tailwindcss.com][TailwindCSS]] classe in your Djula templates without any JavaScript or Node.js tooling

** Usage

Create a new [[https://github.com/fukamachi/caveman][Caveman]] project

#+begin_src lisp
(ql:quickload :caveman2)
(caveman2:make-project #P"~/quicklisp/local-projects/cl-tw-demo")
#+end_src

- Add ~cl-djula-tailwind~ as system dependency


Add a placeholder for the stylesheet in the default template ~templates/layouts/default.html~

#+BEGIN_SRC html
{{ tailwind | safe }}
#+END_SRC

Define a new function called ~render-stylesheet~ in ~src/web.lisp~

#+BEGIN_SRC lisp
(defun render-stylesheet (template)
(setf (getf djula:*default-template-arguments* :tailwind) (cl-djula-tailwind:get-stylesheet template *template-directory*)))
#+END_SRC

Call this function in your routes with the template name as the argument
#+BEGIN_SRC lisp
(defroute "/" ()
(render-stylesheet #P"index.html")
(render #P"index.html"))
#+END_SRC

** Installation
You can install it from quicklisp

#+BEGIN_SRC lisp
(ql:quickload :cl-djula-tailwind)

#+END_SRC

** Author

+ Rajasegar Chandran

** Copyright

Copyright (c) 2022 Rajasegar Chandran