Browse the Ruby on Rails Community.

You are here: Browse Railsplugins Asset Auto Include

Asset Auto Include

Aknowledgements

This plugin is based on the javascript_auto_include by Jamie Dyer. I just ripped it apart to make it suit my needs. Mainly, allow for inclusion of stylesheets and use a different nesting.

If you want the original plugin:

http://github.com/kernow/javascript_auto_include/tree/master
http://hosting.media72.co.uk/blog/2008/05/13/asset-auto-include-rails-plugin/
Resources script/plugin install git://github.com/evilchelu/asset_auto_include.git

== Usage

Add the following to the head of your template file
<%= asset_auto_include_tags :javascript %>
<%= asset_auto_include_tags :stylesheet %>
Now each time the template is loaded asset files in the
public/(javascripts|stylesheets)/ folder that correspond to the name of the
current controller or view will be auto loaded. For example:
/public
  /javascripts
    /accounts
      show.js
/public
  /stylesheets
    /users
      _shared.css
      edit.css
Assuming the above file structure loading each of the following urls would load:
mydomain.com/accounts          # no js files loaded
mydomain.com/accounts/show/1   # loads accounts/show.js
mydomain.com/users             # loads users/_shared.css
mydomain.com/users/edit/1      # loads users/_shared.css and users/edi.css

NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly

Users


See all details


Membership

+ Join this railsplugin

Record Maintainer

'None'