basset icon indicating copy to clipboard operation
basset copied to clipboard

how should basset be used with packages in laravel 4

Open newtonianb opened this issue 11 years ago • 0 comments

Currently the way I use basset is I define all my collections as routes in string inside my basset/config.php file in the form 'controller.method' then I have one dynamic basset loader that loads the collections based on the route.

so for example AccountsController@edit will load basset account.edit

app/config/packages/jasonlewis/basset/config.php

'account.edit' => function($collection) {
  $directory = $collection->directory('assets', function($collection) {
    $collection->stylesheet('css/account/edit.css');
    $collection->javascript('css/account/edit.js');
  });
},

This works fine now my question how do I handle by bundle css and js.

I don't want to create a collection inside app/config/packages/jasonlewis/basset/config.php because this looses the modularity of my package.

Currently the only thing I need to use this package is call in any view != charts::startLoad($data) which calls the startLoadfunction inside workbench/newton/charts/src/Newton/Charts/Charts.php and returns a view.

I'm looking for a way for the bassets to automatically get loaded from the startLoadfunction or somwhere where it could be programatic. How would I do this?

workbench/newton/charts
│   composer.json
│   composer.lock
│   phpunit.xml
│
├───public
│       script.js
│       style.css
│
├───src
│   ├───controllers
│   │       ChartsController.php
│   │
│   ├───Newton
│   │   └───Charts
│   │       │   Charts.php
│   │       │   ChartsServiceProvider.php
│   │       │
│   │       └───Facades
│   │               Charts.php
│   │
│   ├───migrations
│   │       2012_11_06_225921_create_charts_table.php
│   │
│   ├───models
│   │       Chart.php
│   │
│   └───views
│           _table_view.php

newtonianb avatar Sep 13 '13 02:09 newtonianb