Open logicalhan opened 12 years ago
Nope, haven't tried it as yet with Rails, but yeah that could be interesting - might play around with that and get back to you.
So I've figured out a kind of hacky solution. First you need to be on the latest version (0.1.04), as it now supports string arguments instead of blocks. These then get evaluated as a block.
E.g:
Sculpt.render(' p "hi" ')
will now work.
So, in your templates, where you might usually have:
<%= yield %>
You can now have:
<%= raw Sculpt.make(yield) %>
And in your view ERBs you can put Ruby code as if it was inside a Sculpt block.
So that's how you can make it work, but it's not exactly neat. I don't know much about the internals of Rails at the moment, so if someone who does would like to suggest how we can better integrate Sculpt that would be great.
One of the main problems with this is that the Ruby code is still erb, and not actual Ruby (we're just handling it as such). But I'm not sure how you can use pure Ruby for views, and then link it in with Sculpt.
yeah it's a bit tricky, i've been looking into the haml gem to look into how they hook into rails for html processing. if i figure it out a bit, i'll try incorporating some of the haml code with sculpt to see if i can get a jerry-rigged version of it working.
have you tried using this with rails? i'm sorta curious how this would fair as an erb replacement.