jasonlewis / basset

A better asset management package for Laravel.

Home Page:http://jasonlewis.me/code/basset

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dynamically adding assets

newtonianb opened this issue · comments

I'm trying to dynamically add assets from my BaseController given the controller / method, below is a simplified example.

    $path = public_path() . "/assets/css/$controller/$method";

    Basset::collection('custom', function($collection) {
        $collection->directory($path, function($collection) {
            if (file_exists($path . '/style.scss'))
              $collection->stylesheet('style.scss');
            elseif (file_exists($path . '/style.sass')) {
              $collection->stylesheet('style.sass');
            }
        });
    });

However I'm getting Undefined variable: path. How do I pass in that variable to make it accesible?

function($collection) use ($path), see the doc of PHP for more informations.

thanks!