Closed andyparsons closed 9 years ago
I don't have any experience with luminus or selmer, but I would be happy to answer any questions you have. What have you tried? Do these frameworks expose the Ring middleware stack somewhere?
Luminus makes us of ring and compojure, so yes. Selmer is a Django-like templating library into which I'd like to inject Optimus asset URLs. Let me poke around further and come back with a very specific issue. Thanks!
For example, this view function should render the bundle output into the Selmer template (the bracketed content is simply passed into the template). But, this actually outputs the string "clojure.lang.LazySeq@1" so we must be missing a step somewhere.
(defn style-guide [request]
(layout/render
"admin/styleguide.html"
{:page-style (optimus.hiccup/link-to-css-bundles request ["app.css"])}))
Ah yes, that is a bit convoluted if you're not using hiccup. In fact, I've been meaning to change it to be less hiccup-specific. I'll fix that on the train home, and push a new version.
If you want to have it working straight away, include hiccup in your project [hiccup "1.0.4"]
then require [hiccup.core :refer [html]]
and do:
(defn style-guide [request]
(layout/render
"admin/styleguide.html"
{:page-style (html (optimus.hiccup/link-to-css-bundles request ["app.css"]))}))
Ah, of course Dumb mistake not to get the HTML out of hiccup. Thanks. FWIW, more friendliness to Selmer, which is the default templating engine in Luminus would be great for adoption. I think Optimus' approach and flexibility is superior by far to the other options out there.
Glad to hear that. :) I wouldn't call it a dumb mistake as much as a dumb API. I'll get a new version out soon.
I've released [optimus "0.17.0"]
, which removes the optimus.hiccup
namespace in favor of optimus.html
.
The old optimus.hiccup/link-to-css-bundles
created hiccup data structures, which is a mistake. It's specific to one rendering method, and Hiccup works just as well (or better) with strings.
You can replace optimus.hiccup
with optimus.html
, remove hiccup, and all should be well. :)
@magnars thanks for the super-fast update! Trying it now and will report back if any questions pop up.
This one had been brewing for a while, so thanks for giving me the proper incentive to do something about it. :)
Great. Note I removed my last note here, the issue was unrelated to your recent change.
Wondering if there are any examples using optimus asset loaders in a luminus/selmer project? We are keen to try optimus but struggling to wire everything up!