Stolz/Assets — pull request #32 by chrismichaels84 (2014-09-18 19:32:08+00:00)
Title: Add javascript to header or footer

This was forked for my own needs, but I wanted to give you the pull request. If it is not in the direction you want to take the package, I will continue to pull from my own repository.

User can now specify if they want to add javascript to the header or footer of a page. This allows for something like modernizer to be loaded into the header, while jQuery is loaded into the footer.

This can be done through a second argument:
```
Assets::addJs('asset.js', 'header');
Assets::addJs('asset.js', 'footer');
Assets::add('asset.js', 'footer');
```
Or by adding the asset as an array to collections or when registering multiple assets:
```
Assets::add( array(

'app.css', // All CSS goes into the header. No change from master

'vendor/modernizr.js', // This goes to header by default

array('vendor/jquery.js', 'footer'), // Into the footer

array('app.js', 'header'), // Into the header
));
```
Collections work as well:
```
$collection = array(
'app.css',
'vendor/modernizr.js',
array('vendor/jquery.js', 'footer'),
array('app.js', 'header'),
);
Assets::registerCollection($collectionName, $collection);
```
The user can them print the groups separately.
```
Assets::js(); // Prints header by default
Assets::js('header');
Assets::js('footer');
```
Javascript is added to the "header" group by default, so the new feature is 100% backwards compatible. I also added some unit tests for the new functionality. I have been using this in my latest project, and have run through all the standard functionality of the package including pipeline.

I know my diff got messed up, so I wanted to show you exactly what I added:
* added ```$location``` as parameter to ```add(), addJs(), js(), jsPipeline()```
* made ```protected $js``` into a multi-dimensional array with header and footer
* Added auto detection for an array of assets passed to ```add() and addJs()``` that checks to see if the array holds more than one asset or is specifying a location.
* Modified ```getJs()``` so you can specify which location to fetch. With no argument, the method returns a flattened array of ALL js
* add getFullJs() which returns the full ```$js``` property, a multi-dimensional array.
* Added ```$location``` to ```jsPipeline()``` so it fetches the correct group.
* Updated README.md
* Added Unit tests to AssetMangerTest.php

In any case, I'm happy to modify anything so that it fits better into your package.