Embedded Javascripts plugin

Plugin details

This plugin help you to integrate your server-side javascripts in your view.

Websitehttp://blog.lipsiasoft.org/ Repositoryhttp://lipsiasoft.googlecode.com/svn/trunk/embedded_javascripts/ Author Lipsiasoft Tags Javascript LicenseRuby's (MIT)

Documentation

Install the plugin:
ruby script/plugin install http://lipsiasoft.googlecode.com/svn/trunk/embedded_javascripts/

The main problems of webmaster is pass vars to .js files.

The only way wose include your js in the view or put it on partials, but now, with Embedded JavaScripts all is most simple and good to look.

Make a new pure javascript file and give ejs extension and all are done!

Example:

def myview
  @var = "Hello World here"
end


myview.rhtml

  <%= include_javascript "mytest" %>

  Put wath you want here



test.ejs

  alert('<%= @var %>');



Result

  < script type="text/javascript" charset="utf-8">
    alert('Hello World here');
  </ script>

  Put wath you want here



Simple no????

Further Documentation

Edit plugin | Back in time (3 older versions) | Last edited by: hardway, 7 months ago