Forum: Ruby on Rails [ANN] MergeJS - Easily merge, compress, cache, and version y

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.
Scott B. (Guest)
on 2006-06-04 01:12
(Received via mailing list)
After reading Cal Henderson's article on Vitamin Serving Javascript
Fast<http://synthesis.sbecker.net/articles/2006/06/03/w...
was immediately inspired to create a plugin to easily facilitate this
in
Ruby on Rails. I whipped up most of it right then, and finally got
around to
polishing it for release today.

Told myself I wasn't allowed to eat today until I finished. How's that
for
inspiration?

Here you go!

MergeJS:http://synthesis.sbecker.net/pages/merge_js

Thanks!
Roberto S. (Guest)
on 2006-06-04 01:52
(Received via mailing list)
The page seems not to respond. Hope you are o.k. (with or without eating
yet
..)
Scott B. (Guest)
on 2006-06-04 02:20
(Received via mailing list)
Welp, Dreamhost happened to come under a DoS attack right after I
announced it: http://www.dreamhoststatus.com/2006/06/03/more-outages/

How awesome is that? It's real, I swear! Just check back soon!  :)

And don't worry about me. I ate. haha..

- Scott

On 6/3/06, Roberto S. <removed_email_address@domain.invalid> wrote:
> was immediately inspired to create a plugin to easily facilitate this in
>
> _______________________________________________
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
>
>


--
Scott B.
Web D.
Electro Interactive, Inc.
Office: 813-333-5508
http://www.ElectroInteractive.com
Alex W. (Guest)
on 2006-06-04 11:56
Scott B. wrote:
> Welp, Dreamhost happened to come under a DoS attack right after I
> announced it: http://www.dreamhoststatus.com/2006/06/03/more-outages/
>
> How awesome is that? It's real, I swear! Just check back soon!  :)
>
> And don't worry about me. I ate. haha..
>
> - Scott
>
> On 6/3/06, Roberto S. <removed_email_address@domain.invalid> wrote:
>> was immediately inspired to create a plugin to easily facilitate this in
>>

Not bad.  This plugin definately shows promise but a few things would
need improving before I wouls stick it in my app.

I think you should be able to define the js file names as symbols,
rather than strings.  When I tried to use symbols the <script> tag was
not even output to the header.  I would add:

  sources.collect!(&:to_s)

to the top of your helper method.

Also you should be able to say

  <%= javascript_include_merged :defaults %>

just like you can say

  <%= javascript_include_tag :defaults %>

Lastly, I don't like that you have to manually generate the resulting js
file.  I think it should compile it on the fly and then cache it
somehow, like action cacheing.  I can easily see forgetting to run the
rake task and then beating my head against the desk because the new
javascript works in development but not production.
Scott B. (Guest)
on 2006-06-04 21:18
(Received via mailing list)
I like the idea of allowing the use of symbols and using :defaults for
the rails default js files. I will be adding those soon! :)

The idea of the rake task is to process this only once, at the time of
deployment. If you add it to your capistrano deployment script, thats
the last time you'll ever have to think about it. This is the best way
for performance. Having dealt with SLOW shared hosting environments,
I'm pretty adverse to adding any unnecessary processing that has to
happen on each request.

--
Scott B.
Web D.
Electro Interactive, Inc.
http://www.ElectroInteractive.com
Scott B. (Guest)
on 2006-06-05 11:15
(Received via mailing list)
Symbols and :defaults are now supported, along with a bunch of other
little enhancements.

http://synthesis.sbecker.net/pages/merge_js

Thanks!
--
Scott B.
Web D.
Electro Interactive, Inc.
http://www.ElectroInteractive.com
Julian 'Julik' Tarkhanov (Guest)
on 2006-06-05 22:08
(Received via mailing list)
On 4-jun-2006, at 19:16, Scott B. wrote:

> I like the idea of allowing the use of symbols and using :defaults for
> the rails default js files. I will be adding those soon! :)
>
> The idea of the rake task is to process this only once, at the time of
> deployment. If you add it to your capistrano deployment script, thats
> the last time you'll ever have to think about it. This is the best way
> for performance. Having dealt with SLOW shared hosting environments,
> I'm pretty adverse to adding any unnecessary processing that has to
> happen on each request.

Put the JS rebuild into the environment.rb, it will be run when the
app is starting. After getting going with Rails I tend to look with
great suspicion at all the "build, rebuild, recompile and remerge and
then archive and compact and THEN it will run" type operations.

--
Julian 'Julik' Tarkhanov
please send all personal mail to
me at julik.nl
Scott B. (Guest)
on 2006-06-06 00:21
(Received via mailing list)
Well, having dealt with Dreamhost (el slowio), the biggest performance
hit is on the first request - and they kill off your .fcgi processes
fairly often, so you have to endure that yet again. I personally hate
it when plugins tack on more stuff to the startup process. The more
javascript files you have to compress, the longer your startup will
become. BUT, I guess I'll see about adding this option for those that
want it. Using Capistrano makes the rake task option a peice of cake,
so thats what I prefer.

--
Scott B.
Web D.
Electro Interactive, Inc.
http://www.ElectroInteractive.com
Scott Fortmann-Roe (Guest)
on 2006-06-06 14:45
(Received via mailing list)
Could this be done for CSS files too. Maybe have the plugin do both.
Scott B. (Guest)
on 2006-06-06 23:06
Scott Fortmann-Roe wrote:
> Could this be done for CSS files too. Maybe have the plugin do both.

Yep, in the Plan. :)

--
Scott B.
Web D.
Electro Interactive, Inc.
http://www.ElectroInteractive.com
This topic is locked and can not be replied to.