Browse the Ruby on Rails Community.

You are here: Browse Railsplugins Asset Tag Extensions

Asset Tag Extensions

Extensions to the standard asset tag helpers available in Rails to help create manageable stylesheets and javascripts.

AssetTagExtensions provides the following convenience methods:

  • swf_tag – Add a Flash swf tag complete with asset id support
  • additional_js – Specify additional javascript files to be included via javascript_include_tag
  • additional_css – Specify additional stylesheets to be included via stylesheet_link_tag

AssetTagExtensions will extend the standard helpers for including javascript and stylesheet files to have the following behavior:

1. Work unmodified, can be dropped into existing projects 2. Check for the existense of, and include, controller.(js|css) and controller/action.(js|css) 3. Include additional js and css files specified in views with additional_(js|css)

The controller and action specific assets was borrowed from the excellent Styler and Javascripter plugins. The additional_(js|css) convenience methods are from my own experience in having modular assets. The swf_tag just seemed to be a natural fit as another extension.

This allows you to easily modularize your javascript and stylesheets into an almost endless amount of configurations.

Example

In your layout:

<%= javascript_include_tag :default %>

In your home/index.rhtml:

<%= additional_js ‘ads’ %>

Output:

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'