Forum: Ruby on Rails Lazy loading of scriptaculous

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Bd0ecd69dba2aab1a0261ee46e090139?d=identicon&s=25 Nicholas Wieland (Guest)
on 2007-04-04 11:45
(Received via mailing list)
Hi *, both scriptaculous and prototype are quite big, and I don't use
all the goodness inside there, including :defaults is a bit too much
for me.
Someone knows of a way to dynamically load what's effectively used
inside a side ?
It would be a great feature ...


Nicholas Wieland
41809768bb32f3217337361125c2a388?d=identicon&s=25 Camo (Guest)
on 2007-04-04 15:04
(Received via mailing list)
Do you mean load dynamically on the client side?

If so, can't say i've heard any tricks to achieving this, what you
could do is compress the files, this will help reduce the size.  Also
I was under the impression that by default most browsers cache
javascript so I guess you could see it as just the one download. But i
could be wrong.  Hope this helps

Also if you choose a different javascript library consider moo tools
which allows you to choose only options you want.
66f8deb95f8174885c85592e8c86377c?d=identicon&s=25 Keith Davey (Guest)
on 2007-04-04 15:24
(Received via mailing list)
I came across this a while ago, I was already loading javascript details
added mapping code as well. I was using Virtual Earth maps as Google
are crap for

In order to only have one layout file but still only load the mapping
on the pages where
I need it, I added an     <%= @mapcode -%> to the layout.

Then in my controller I can only set the @mapcode when I want it set.

@mapcode = get_mapcode


def get_mapcode

code = "    <script src=\"


Not quite what you are looking for but it does the trick for me.

This topic is locked and can not be replied to.