Skip to content

Instantly share code, notes, and snippets.

@candera
Created September 25, 2011 02:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save candera/1240124 to your computer and use it in GitHub Desktop.
Save candera/1240124 to your computer and use it in GitHub Desktop.
Clojure SASS Compiler Design Notes

-- mode: markdown --

Design Notes

Project Code Name

TODO!

lip? mouth? backtalk? guff? sauce?

Leading contender: sauce

Overview

I want to write a SASS compiler in Clojure. Or find one that can be consumed by Clojure (e.g. is written in Java). I want to do this so that I can use SASS in my Clojure web projects.

I don't mind writing one myself, because I think it would teach me two things:

  • SASS
  • How to write parsers/compilers

As a side benefit, it would be nice if the Clojure community wound up with a SASS parser they could use.

Survey of Available Implementations

The Canonical One

The canonical SASS implementation is written in Ruby. I want something that can be included as a Maven dependency: relying on JRuby is too heavy a dependency.

That said, I think whatever I come up with should use the canonical one as the reference implementation and be able to do whatever it does, or at least provide a subset that works the same way.

Recommendation: TODO.

jsass

URL: http://code.google.com/p/jsass/

Recommendation: Undecided. Grammar may prove useful. TODO.

Pros

  • Written in Java
  • Has an ANTLR grammar here ** If nothing else, this could provide a good starting point for a Clojure implementation

Cons

  • Looks like it hasn't been updated in a long time

sass-java

URL: https://github.com/darrinholst/sass-java

Recommendation: Do not use.

It's a "filter", whatever that means.

Cons

  • Appears to require JRuby
  • Looks like all it does is call out to Ruby to do the actual work

Survey of Parser Generator Libraries

TODO

Analysis

Decide first if it makes sense to just use the canonical SASS tools. If that's not a slam dunk, see what it would take to use something that's out there (looks like that's just jsass). If that doesn't seem like it would work, start thinking about what it would take to write one.

Should I just use the canonical tools?

Should I just use this one? Is there a good reason to have a Clojure implementation, or should I just use the sass command-line tool to convert SASS to CSS whenever I need to? On the one hand, it's not a big deal to run SASS through the converter. It wouldn't even be that hard to call out to the SASS converter dynamically from the web app. Presumably, there are lots of ways to do that, from manually to having the web app invoke the converter directly to having it get invoked by Leiningen somehow.

It does seem a little weird and off-putting to require that a Ruby tool be installed to do Clojure web work. But that begs the question whether I'm writing a general-purpose tool or just trying to do something one-off to support a particular project.

Should I use jsass?

TODO

Should I write something?

TODO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment