Laravel: Basset how to combine collection?

205 views Asked by At

Ihave 2 collection:

Basset::collection('_b_pre', function($collection) {
    $collection->add('../vendor/twitter/bootstrap/less/bootstrap.less')->apply('Less')->andApply('CssMin');
    $collection->add('../app/stylesheets/less/ad404/manifest.less')->apply('Less')->andApply('CssMin');
    $collection->add('../app/javascripts/coffee/ad404/main.coffee')->apply('CoffeeScript')->andApply('JsMin');
});

Basset::collection('_b_pre_product', function($collection) {
    $collection->add('../vendor/twitter/bootstrap/less/bootstrap.less')->apply('Less')->andApply('CssMin');
    $collection->add('../app/stylesheets/less/ad404/manifest.less')->apply('Less')->andApply('CssMin');
    $collection->add('../app/javascripts/coffee/ad404/add_product.coffee')->apply('CoffeeScript')->andApply('JsMin');
});

The only difference between those 2 collections are the js file, is there any way to combine or make it shorter?

1

There are 1 answers

0
SwiftD On

I dont really understand what your asking. If you dont want to just lump everything into one collection (generally my preferred approach to keep http requests down - but I understand this may not be practical on larger projects) then you would create a base collection with bootstrap and manifest in and then create a separate collection for each set of page specific assets to only be loaded with that page.