Home > General > Javascript Autoinclude For MVC

Javascript Autoinclude For MVC

On his blog Scott Koon gives a good tip on where to place your view specific artifacts.

But if you are using View specific CSS or JavaScript files, you should put them alongside your view page in the Views directory. This allows you to quickly find the file you want to work on.

Scott Koon

While I think that’s an excellent idea for organization, I think that the Javascript Auto Include plugin for Rails does it up a little more elegantly. It creates a directory structure for you to place your JS files organized by view.

For example:

So, for the edit view of the users controller, the plugin would automatically include edit.js for you.

EDIT: If I had a little time, I might hook up something like this.

Categories: General
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: