Does anyone use Gaka with Noir?

51 views
Skip to first unread message

Sean S

unread,
Oct 31, 2012, 1:14:58 PM10/31/12
to clj-...@googlegroups.com
Extremely new to Clojure and even more so with Noir.  Only snag I've hit is finding a clojure -> css plugin, and getting it to work.  Currently trying with Gaka, but have no idea how I can force the creation of the css file other than having:

    (save-css "public/css/style.css" rules)

at the bottom of the clj file.  I have it in src/first/css/baseCss.clj ("first" being the project name)

Here's the whole file:

    (ns first.css.baseCss
(require [gaka.core :as gaka]))

    (def rules [:div#foo
              :margin "0px"
                [:span.bar
                   :color "black"
                   :font-weight "bold"
                 [:a:hover
                    :text-decoration "none"]]])

    (save-css "public/css/style.css" rules)

And the dependencies block in the project file is:

    :dependencies [
       [org.clojure/clojure "1.4.0"]
       [noir "1.3.0-beta3"]
       [gaka "0.3.0"]]

Pretty much cut and paste from the github page.  Not completely invested in Gaka if there is a better alternative.  Just looks like it's had the most recent updates.

Mark Rathwell

unread,
Oct 31, 2012, 2:06:11 PM10/31/12
to clj-...@googlegroups.com
It's been a long time, but I used to just check whether I was in development or production, and only output the css file during development, something like this (or however you are determining environment):

(when (noir.options/dev-mode?)
  (save-css "public/css/style.css" rules))

Sean S

unread,
Oct 31, 2012, 3:48:46 PM10/31/12
to clj-...@googlegroups.com
Problem is I haven't even arrived at that point since the file isn't being created at all.  I'm hoping it's something really simple, and  this is more about my lack of clojure knowledge. 

Chris Granger

unread,
Oct 31, 2012, 3:50:18 PM10/31/12
to clj-noir
are you requiring that file anywhere in your project?

Cheers,
Chris.

Mark Rathwell

unread,
Oct 31, 2012, 3:53:57 PM10/31/12
to clj-...@googlegroups.com
Ah, yeah, as Chris said, require the file that contains all of the Gaka rules, etc., somewhere (for example in a file containing defpages).  That will cause the Gaka file to be read and your top-level save will then be executed.

Sean S

unread,
Oct 31, 2012, 4:05:12 PM10/31/12
to clj-...@googlegroups.com
Awesome.   Works now.  Thanks a lot.
Reply all
Reply to author
Forward
0 new messages