-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HAML Compatibility #4
Comments
Deface in it's current incarnation couldn't support HAML as all the selectors are based on CSS standards and HAML obviously isn't parseable (by Nokogiri). So we'd need come up with a way to parse and select elements of a HAML document. I know there's libraries out there that might get us some of the way towards that, but someone uses HAML is going to have to take point on this development. I'm glad to help integrate it with Deface, when the time comes. |
I've done a quick hack in which I convert haml to erb and then erb to haml not the most viable solution but it was a quick one we needed. |
I'm really interested in using this for Fat Free CRM's plugins. We currently have a simple hook system that needs a lot of improvement. However, all our views are written in HAML. I really like the sound of converting from HAML to ERB, and then passing that to @stephanep, could you please share how you are converting HAML to ERB? |
This looks very promising: https://gist.github.com/17371 Hope to give it a try sometime soon. |
@ndbroadbent - I'd be delighted to get HAML support baked into Deface, I was under the impression that HAML couldn't be reliably converted back to ERB. That example looks very promising. I've got some other HAML improvements locally too, that allow you to supply HAML as the replacement markup. I'll get it pushed to a branch for you to review shortly. |
@ndbroadbent @stephanep @Florian95 - I've got HAML support added to a branch for now. I'd appreciate if you guys could test it out and let me know how it works for you. https://github.com/railsdog/deface/tree/haml It works by using the Haml2Erb converter that @ndbroadbent mentions above, when Deface detects a haml view that's a target of an override, it will first convert the haml to erb and then apply the overrides. You can also use haml files for the :template or :partial options (again deface will just convert to ERB). Finally, I've added a new option instead of :text (which expects erb), you can pass a fragment of haml to the :haml option. EG: There's no test or docs coverage yet, just wanted to see if it was a viable solution before I spend anymore time on it! |
That's awesome, thanks! We're quite busy right now finishing some other FFCRM features for our organization, but I will try to find some time to test this out in a plugin. Perhaps early next week. |
I'm testing your deface haml branch with |
@stdcall Can you give me a copy of your entire spree_application file for testing? |
@stdcall I just pushed a fix for those issues you were seeing can you update to the latest haml branch and try again. In order to get your spree_application.html.haml to parse you need to indent the following line: - @bc = body_class So that it is inside the head tag - nokogiri doesn't allow any other tags at the same level as head or body. |
Just pushed some more updates to the haml branch. |
Has anyone given the haml stuff a real test? I've just done some very basic stuff, as I don't use haml myself. |
I think I found an issue. It doesn't like haml with blocks. I tried the following: This returns "unexpected $end, expecting keyword_end" errors For now my work around is to put haml blocks in an erb partial and then do I use a lot of haml I will report back with more issues if I find any, but this is the only one so far. |
@dvictory thanks for reporting this, I'll get working on a fix for this. |
@dvictory fixed the block handling: |
@BDQ Awesome! Works like a champ! |
Marking this as closed, feel free to file new ticket for specific haml issues. |
Hi,
I use Spree, and they use Deface... But all my views are in HAML.
Its possible to add support of HAML to deface ?
Regards,
The text was updated successfully, but these errors were encountered: