Extracting HTML/Javascript from Rails

WebDeveloper Toolbar for firefox has an option called view generated source. You can also view the generated JS with that tool. Another little neat tool is View Source Chart for Firefox which lets you see the generated DOM tree.

I also love developing using helpers, RJS and HAML. It would be awesome to be able to use these tools, and output straight XHTML and Javascript for a non-Rails environment.

I can only think of XPath/XSLTs for this.

Haml can actually be generated in a non-Rails environment.

Just install the gem

gem install haml

and then include it

require 'rubygems' require 'haml'

haml_object = Haml::Engine.new("%haml") haml_object.render #returns the XHTML

Hope this helps!