Plugins - JavascriptRequire

StarAdd to favorites

This plugin allows dynamic inclusion of dependent javascript files at the application level. It does this by reading the first line of any javascript file and determining whether it is a ‘require’ line. Example:

  // require prototype

  var element = $('foo');  // prototype.js must be included before this file, so `$' etc are all available.

Recursive requires are supported, like so:

  ## student.js
  // require person
  ...

  ## person.js
  // require base
  ...

  ## base.js
  ...

In this case calling +javascript_include_tag(‘student’)+ will return:

The files to include are cached, so each file is only read once to determine its dependencies (unless you’re in development mode, then it is recomputed with each request).

NOTE: This has NOT been tested with using asset hosts (assets.example.com, Akamai, etc).

http://eventualbuddha.textdriven.com/svn/javascript_require/

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

Misc. Enhancements

Tags

Comments

Add a comment

Search Plugins

Query syntax

Plugins by Category

Sponsors

Rails Kits: Get Code. Get Moving.

Have a comment?