Skip to content

JulianBirch/Hendrix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hendrix - clojure asset pipeline

Hendrix is intended to be a web asset pipeline for Clojure, solving the same problem as the rails asset pipeline, but not necessarily in the same way. It's motivated by my experience of ASP.NET MVC and its deficiencies.

What it can do

At the moment, the honest answer is very little. There's

  • a pretty basic make (called execute) missing task scheduling
  • a generalized watch infrastructure
  • a neat way of handling temporary directories
  • some fairly cool test code that enables you to fake out the file system

So, a lot of meta. In fact, the only actual use of it right now is to compile bootstrap with your own variable file.

How to use it

At the moment, its best used through a lein run command. Later versions will hopefully support more magic. Here's some actual working code:

(ns semele.commands
  (:use [hendrix core command watch]
        [clojure pprint]))

(def bootstrap
  (new-merge-rule
   "assets/variables.less"
   "checkouts/bootstrap/lib/*.less"))

(def cb (new-rule (bootstrap "bootstrap.less")
                   "resources/public/site.css"
                   lessc
                   bootstrap))

(defn compile-bootstrap [] (execute bootstrap cb))

(defn watch [] (start compile-bootstrap))

"bootstrap" defines rule for a temporary directory with the contents of the two expressions following. Earlier items take precedence over later ones. "cb" is the actual rule to compile bootstrap. The order of parameters is

  • The main file. Observe the way the temporary directory is referenced.
  • The output file
  • The command to use, defined in hendrix.command
  • Implicit inputs to check. Here, the entire contents of the temporary directory are referenced.

What's next?

Things I'd like it to be able to do, roughly in order:

  • cljs-watch functionality
  • Minify
  • Switching between uncompressed and minified versions
  • Allowing live-reloading of CSS

Adding test watching functionality would be cool, but would require some thought. I don't think I need a general aggregation strategy like rails, given that less and cljs already have their own, but I could be proved wrong.

Releases

No releases published

Packages

No packages published