Using liquid with haml - ruby-on-rails

I'm planning to develop a CMS with ruby/rails. One of the main key features that I'm planning is to give the user to edit their layout (I'm planning to do this through liquid)
meanwhile i have red some good articles on HAML and SaaS. So just wondering whether i can use
haml + liquid + sass for my work
If possible i would thankful if you could point me some resources
thanks in advance
cheers,
sameera

I think that is possible, take a look at this project mixing Jekyll, Haml and SCSS.

I don't think that HAML and Liquid are really compatible. Plus, as HAML has significant whitespace, i don't see it as a good idea to introduce it as the markup for CMS content editing (assuming we are dealing with an average webmaster or a regular user with a WYSIWYG editor here).

I've seen haml and liquid working at least once on this jekyll fork:
http://github.com/henrik/jekyll
So what you are proposing is certainly possible. I don't know whether it will be "easy", though.

Related

What do I need to do to convert the views in my Rails app from HAML to ERB?

I have a Rails app that I'm customizing. The more I work on it, the more I both love and hate HAML. I love that HAML's so clean to look at it, I hate that I can't intuitively trouble shoot with Chrome Inspector or Safari Developer Tools. So, I have gathered that conversion to ERB is the best thing for others in my shoes (designers or other mere mortals with basic knowledge of HTML and CSS, wanting to customize the content in this open source Rails app).
What are the steps involved in converting the views from HAML to ERB
and what else will I need to change? ...routes? controllers? anything?
There are a lot of the down-in-the-weeds questions about this, but I'm looking for an overview so I can wrap my head around what to expect.
If you're just converting HAML->HTML/ERB You shouldn't have any need to be changing any controllers, routes or models at all. But I wouldn't necessarily recommend taking that route. HAML is great because it stops people being syntactically incorrect in their HTML. It essentially forces you to not make mistakes.
I don't really understand the issue with troubleshooting through chrome/firefox as all it's outputting is HTML at the end of the day.

Pure HTML template solution for Rails?

I love HAML, however recently our projects have come under some scrutiny with regards to reliance on non-html structured templates. I thought I'd take it a step further by asking the question, "How can we use pure HTML design based templates in Ruby on Rails?"
The closest thing I've found so far is a very interesting project that has it's most recent update from 2010 called Kwartz from the author of Erubis.
Is there a project that upholds this pure HTML isolation for designers that is up-to-date and viable on Rails 3.2.x?
Your designers are correct that HAML does not have widespread HTML tool support.
A really excellent solution IMHO is Handlebars. It is simpler than HAML, and will work with more HTML tools because Handlebars emphasizes moving code out of the page template and into the controller. This also is good for writing maintainable pages with designers and also for security.
Handlebars is led by Yehuda Katz, who helped write Rails 3, is a core contributor to JavaScript, and is currently working on Ember.js which also leverages Handlebars.
http://handlebarsjs.com/
You are either going to do something with the templates, right? As in, the designer gives you the template, you strip out the parts that already belong to app/views/layouts/application, inject the necessary ruby to get your data into the view etc.
So what's the problem? Let the designers provide their templates in HTML, you convert them to HAML when using in the app, instead of converting them to ERB.

FAQ Plug-in or Gem for Rails 3?

FAQs seem to be a pretty commonly needed feature in a web application..
but it seems like there are no gems or plugins available for Rails.
Can you recommend a gem or plugin which provides FAQs to a Rails app?
Obviously you could make a simple FAQ very quickly with Rails, but there is much
more functionality that can be added: votes, search, categories, roles,
comments, markup, embedded links, tags, ... just to name a few.
Seems like people are re-inventing the wheel a lot for FAQs
I just published a gem for it.
https://github.com/railscash/how_to
Hope that helps, Its in development phase but we are using it actively. Your comments/feedback will be highly appreciated
I think either using BrowserCMS (http://browsercms.org) or RefineryCMS (http://refinerycms.com/) fits the bill for when you need more generic content pages. I prefer to just use a generic CMS instead of creating a gem/plugin for FAQS as you'll have other pages that could easily be thrown into a CMS engine as well. Saves developer time from having to update mostly static HTML pages.
Absolutely - Check out https://oraguide.com - Everything is streamlined / hosted in the cloud. It runs directly on the page as a floating div.

Logic free templates for Ruby on Rails

I am looking for a technique for moving Ruby on Rails methods and logic (<% if, link_to etc.) away from templates. So far I have been looking at the mustache template language, but I am not entire sure if this is the way to go.
Any thoughts? Would you recommend mustache or is there a better choice?
In addition to Mustache, there is Liquid (used by Shopify) and Radius (used by Radiant). You may want to check them out.

Other Rails templates types

Erb is the default template type in Rails and I read about Haml.
What other types exist and can be used in Rails?
Thanks.
Take a look at the Ruby Toolbox.
I only know Mustache, Liquid and Markaby of those above, but seems there are pretty many other alternatives.
Rails 3 uses Erubis by default.
You may also want to take a look at slim, which is elegant in a HAML fashion but apparently faster! https://github.com/stonean/slim

Resources