Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,31 @@ a listener in the "Module.php" of those modules which contain public assets. A
very basic example, assuming your asset directory is called "public", looks like
this:

use BaconAssetLoader\Asset\Collection as AssetCollection;
use Zend\Mvc\MvcEvent;
use Zend\EventManager\Event;
```php
use BaconAssetLoader\Asset\Collection as AssetCollection;
use Zend\Mvc\MvcEvent;
use Zend\EventManager\Event;

// ...

public function onBootstrap(MvcEvent $mvcEvent)
{
$sm = $mvcEvent->getApplication()->getServiceManager();
$sm->get('BaconAssetLoader.AssetManager')->getEventManager()->attach(
'collectAssetInformation',
function(Event $event) {
$event->getTarget()->addAssets(new AssetCollection(__DIR__ . '/public'));
}
);
}
public function onBootstrap(MvcEvent $mvcEvent)
{
$sm = $mvcEvent->getApplication()->getServiceManager();
$sm->get('BaconAssetLoader.AssetManager')->getEventManager()->attach(
'collectAssetInformation',
function(Event $event) {
$event->getTarget()->addAssets(new AssetCollection(__DIR__ . '/public'));
}
);
}
```

Publishing assets in your build
-------------------------------
When building your project, you likely want to publish all your assets into a
single directory later accessible by your web-server. To do this, simply make
the following call on your console:

php public/index.php baconassetloader publish-assets public
```sh
php public/index.php baconassetloader publish-assets public
```