Question: In a Sails.js application, how can I include javascript assets selectively? 

For instance, if I have an admin page and admin.js lives inside the assets/js directory. How do I keep the admin.js from loading on the public index page?

I'm aware that I could move the js out to the public directory, and include the script in my admin view's template. But I'm still unable to include it after the **assets.js()** call inserts it's javascript. I need it to be inserted after the **sails.io.js** script is loaded.

Is there any way to selectively load scripts and still have access to the **sails.io.js** which is automatically included with the **assets.js()** function call? Is there a better paradigm for this kind of situation?

EDIT:

Since the release of SailsJS 0.9 and the restructuring of the asset management system, this question doesn't really apply anymore.

Answer: 
I know this is a old question but since people are still looking for this. 

Sails has a folder called tasks in the root after you create a new project. 

The file you are looking for is 

> 
> pipeline.js
> 
> 
> 

That file holds a variable called `jsFilesToInject`

```
// Client-side javascript files to inject in order
// (uses Grunt-style wildcard/glob/splat expressions)
var jsFilesToInject = [

  // Load sails.io before everything else
  // 'js/dependencies/sails.io.js',
  'js/sails.io.js'

  // Dependencies like jQuery, or Angular are brought in here
  'js/dependencies/**/*.js',

  // All of the rest of your client-side js files
  // will be injected here in no particular order.
  'js/**/*.js'
];

```

Just put your script that you want loaded before sails.io.js.

This is relevant for sails 0.11.x 

another way that is valid is to create a views/partials folder

and create a new file like mapScripts.ejs
drop the script tags there and in your view use 

```
<% include ../partials/mapScripts %>

```
Yes, you put a condition in template. :)

or add another "block" for your js. 

```
extends ../layout

block body
    <h1>hello</h1>

block jsscripts
    <scripts> ..... </script>

```