Plugins - Resource On Demand

StarAdd to favorites

This includes javascript and stylesheet information for external resource files from anywhere in your views as needed. These can be deeply nested in partials or in layouts. This plugin ensures that there is no duplicates included.

The sheets are only included if you have requested them in your view somewhere.
No more downloading all your javascript files just to view a welcome page.

Daniel Neighman

http://svn.devjavu.com/liquid

Rails' (MIT)

  • Currently 4.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Assets

Tags

Comments

Add a comment
Bill Harding 3 Sep 2007

Hey Daniel and all,

This looks like an awesome plugin that should solve the problem I'm having (don't want to litter my layout with 20 Javascript includes). However, after grabbing the plugin and following the instructions that are included in it, I still don't seem to be getting my Javascript files included. I suspect it may have something to do with the fact that I'm rendering my partials via AJAX?

Here is the line with which I include it in the layout:

<%= resource_on_demand %> ... <%= javascriptincludetag :defaults %>

And in the file itself,

<% requirejavascript "imagegallery", :defaults %>

I get no errors when I run this, and having stepped into the code a ways, it looks like it's trying to include the Javascript (that is, I can see no errors in its process). But still, the partial I'm loading via AJAX doesn't include the "image_gallery.js" file that I am trying to require (the partial is just blank where that call lies). Has anyone else had this problem?

Thanks, Bill

James 22 Feb 2007

Yeah it could be based on the filename like in my example or any other convention you think would work well.

On a side note, do you know if the plugin works with other CSS related plugins like CSS Dryer?

Daniel N 19 Jan 2007

Hi James.
<p>I'm glad you like the plugin. I wasn't sure if it would be useful to anyone else. </p> <p> I'm not sure how an auto-detect would work on the css file. Would it be based purely on name or some other requirement. What if there was an argument that allowed IE only inclusion? </p>

James 19 Dec 2006

Good plugin. I've been looking for a good way to manage my JS and CS resources and this seems to fit the bill quite nicely.

One additional feature I'd love to see would be for the require_stylesheet method to auto-detect IE specific stylesheets and add a link for those too (in a conditional comment).

So if you have say, site.css and site.ie6.css you end up with two links with the second in a conditional comment.

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?