hcatlin/sassruby — pull request #7 by leafo (2013-12-20 19:36:08+00:00)
Title: Fixes and custom function support

Hello,

I'm making this pull request just to make you aware of these changes. You can pick and choose what you want and I can re-submit. I did a couple things. The ffi bindings were out of date so I updated them to work with latest version of libsass. I didn't notice the other pull request #5 also did this until I wrote my code. It looks like we did approximately the same thing.

I added custom function support. This depends on this patch for libsass: . I did this by exposing all the `Sass_Value` types and writing code to convert between them and ruby. It would be nice to merge that patch into libsass. (I have my own version that only adds custom function support with no other changes so if that's preferred I can submit that as a pull request)

The custom function interface is pretty basic, it mimics the libsass api instead of the original sass one but all the groundwork is there to make it match ruby sass's api.

It looks like this:

```ruby
engine = SassC::Engine.new(".hello { color: hello(one, two, three); }")

engine.custom_function "hello($arg1, $arg2, $arg3)" do |arg_list|
arg_list.join("-")
end
```

I wrote specs for all code I added and specs for basic execution which were missing.

Lastly, I noticed some `.bundle` variant of libsass was hardcoded into the `SassC::Lib`. I renamed the referenced library to just sass which means that it should load the library installed in the system (of any platform). I'm not too familiar with what is preferred for native extensions, the extconf stuff didn't work anyway when installing the gem because it didn't know how to check out the submodule.

Lastly I made it run on ruby 1.8 becuase that's what we currently use. Just a few minor changes.

sassruby speeds up asset compilation for our deploys by minutes so I'd love to see this code be available for more developers.

Thanks