Stump Assets
  • Namespace
  • Class
  • Tree
  • Todo
  • Download

Namespaces

  • Skimia
    • Assets
      • Console
        • Commands
      • Events
      • Providers
      • Scanner

Classes

  • Skimia\Assets\AssetsServiceProvider
  • Skimia\Assets\Console\Commands\DumpCollectionsCommand
  • Skimia\Assets\Console\Commands\FlushPipelineCommand
  • Skimia\Assets\Events\BeforeMergeCollectionFiles
  • Skimia\Assets\Manager
  • Skimia\Assets\Providers\StolzAssetsServiceProvider
  • Skimia\Assets\Scanner\Scanner
  • Skimia\Assets\Scanner\ScannerServiceProvider
 1 <?php
 2 
 3 namespace Skimia\Assets\Providers;
 4 
 5 use Skimia\Assets\Console\Commands\FlushPipelineCommand;
 6 use Skimia\Assets\Manager as Assets;
 7 use Illuminate\Foundation\AliasLoader;
 8 use Stolz\Assets\Laravel\ServiceProvider as StolzProvider;
 9 
10 class StolzAssetsServiceProvider extends StolzProvider
11 {
12     /**
13      * Perform post-registration booting of services.
14      *
15      * @return void
16      */
17     public function boot()
18     {
19         // Add 'Assets' facade alias
20         AliasLoader::getInstance()->alias('Assets', 'Stolz\Assets\Laravel\Facade');
21         // Register the Artisan command
22         $this->commands('stolz.assets.command.flush');
23     }
24 
25     /**
26      * Register bindings in the container.
27      *
28      * @return void
29      */
30     public function register()
31     {
32         // Register the Artisan command binding
33         $this->app->bind('stolz.assets.command.flush', function ($app) {
34             return new FlushPipelineCommand();
35         });
36         // Merge user's configuration with the default package config file
37         //$this->mergeConfigFrom(__DIR__ . '/config.php', 'assets');
38         $config = $this->app['config']->get('assets.groups', []);
39         // Register the library instances bindings ...
40         // No groups defined. Assume the config is for the default group.
41         if (! isset($config['default'])) {
42             return $this->registerAssetsManagerInstance('default', $config);
43         }
44         // Multiple groups
45         foreach ($config as $groupName => $groupConfig) {
46             $this->registerAssetsManagerInstance($groupName, (array) $groupConfig);
47         }
48     }
49 
50     /**
51      * Register an instance of the assets manager library in the IoC container.
52      *
53      * @param  string $name   Name of the group
54      * @param  array  $config Config of the group
55      *
56      * @return void
57      */
58     protected function registerAssetsManagerInstance($name, array $config)
59     {
60         $this->app->singleton("stolz.assets.group.$name", function ($app) use ($config) {
61             if (! isset($config['public_dir'])) {
62                 $config['public_dir'] = public_path();
63             }
64 
65             $config['collections_dir'] = $this->app['config']->get('assets.collections_dir', 'collections');
66 
67             return new Assets($config);
68         });
69     }
70 }
71 
Stump Assets API documentation generated by ApiGen