Forum: Ruby on Rails Extracting HTML/Javascript from Rails

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5bc510a945a1fe39244ec327220c13b0?d=identicon&s=25 Bryan Mills (Guest)
on 2007-02-17 01:42
Hi.

Is there a way, or has anyone written anything that would let me extract
the HTML and Javascript code that Rails generates? I'm going to be
applying for a front-end design position, and would like to be able to
show some samples from my Rails work without having to run the apps. I
can only get so much with View Source.

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.

Any thoughts?
D0cd6b10e01bacb976b3b815a9c660bc?d=identicon&s=25 Alex Wayne (squeegy)
on 2007-02-17 02:07
Bryan Mills wrote:
> Hi.
>
> Is there a way, or has anyone written anything that would let me extract
> the HTML and Javascript code that Rails generates? I'm going to be
> applying for a front-end design position, and would like to be able to
> show some samples from my Rails work without having to run the apps. I
> can only get so much with View Source.
>
> 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.
>
> Any thoughts?

Turn on page caching for all your actions in all your controllers, and
then go to all the pages in your browser.

All your html would dumped to the public directory.  However things like
redirects after form submit would not work.
02693beb6285803295b5ada9680a1817?d=identicon&s=25 aminox@gmail.com (Guest)
on 2007-02-17 04:09
(Received via mailing list)
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.



On Feb 16, 7:42 pm, Bryan Mills <rails-mailing-l...@andreas-s.net>
5bc510a945a1fe39244ec327220c13b0?d=identicon&s=25 Bryan Mills (Guest)
on 2007-02-17 16:02
aminox@gmail.com wrote:
> 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.
>
>
>
> On Feb 16, 7:42 pm, Bryan Mills <rails-mailing-l...@andreas-s.net>


Thank you both!
A77873df3a9766b208e009248a2a9a56?d=identicon&s=25 hampton catlin (Guest)
on 2007-03-01 18:28
(Received via mailing list)
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!

-hampton.



On Feb 17, 10:02 am, Bryan Mills <rails-mailing-l...@andreas-s.net>
This topic is locked and can not be replied to.