Skip to content

rajasegar/cl-djula-tailwind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 TailwindCSS classe in your Djula templates without any JavaScript or Node.js tooling

Usage

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"))

Installation

You can install it from quicklisp

(ql:quickload :cl-djula-tailwind)

Author

  • Rajasegar Chandran

Copyright

Copyright (c) 2022 Rajasegar Chandran

Releases

No releases published

Packages

No packages published