Reputation: 4336
How to configure project.clj file to configure it to output html & css files from hiccup & garden on compiling, so that i can deploy to server without any dynamic css/html loading on client side ?
Upvotes: 0
Views: 618
Reputation: 1907
You can use the lein-garden
leiningen plugin: https://github.com/noprompt/lein-garden.
Here's an example config.
(defproject cash-money "1.1.1"
:plugins [[lein-garden "X.X.X"]]
:garden {:builds [{;; Optional name of the build:
:id "screen"
;; Source paths where the stylesheet source code is
:source-paths ["src/styles"]
;; The var containing your stylesheet:
:stylesheet cash-money.core/screen
;; Compiler flags passed to `garden.core/css`:
:compiler {;; Where to save the file:
:output-to "resources/screen.css"
;; Compress the output?
:pretty-print? false}}]})
Then you can run lein garden auto
to watch for changes and automatically recompile.
If you want an example of a codebase using this: https://github.com/Dexterminator/spotify-data-extrapolator/tree/db8d6e16529940272409598c8ac0fdbbaf739646
To help you find stuff like this in the future, I'll describe a process for discovery.
I found this by going to the garden
github repository (https://github.com/noprompt/garden) and looking through the code for a bit of text that looked like it would be unique to garden
so that I could search all of github and find other repositories that used garden
. The bit of text I chose was defpseudoelement
. I scanned the projects that were already using garden
and found one that mentioned running lein garden auto
in the readme. Searching again for lein garden auto
took me to the lein-garden
leiningen plugin. In hindsight, it would probably make more sense to see what other libraries the author of garden
has written. That would have taken us directly to the plugin. C'est la vie.
Upvotes: 1
Reputation: 516
If you don't really need to use Leiningen, using Boot you can do it easily with perun.io, especially if website is the primary objective:
https://perun.io/guides/getting-started/
https://github.com/hashobject/perun.
I rewrote my website that way https://github.com/ArchieT/website-archiet.
If there is a need to use Lein, maybe I'll look at it later as I don't have much time right now.
It should not be hard to do.
Upvotes: 1