After running
php app/console assetic:dump --env=prod
all the assets are dumpped.
Is there any way to dump only one file?
Looks like you will have to create your own command :
<?php
namespace Your\Namespace\Command;
use Symfony\Bundle\AsseticBundle\Command\AbstractCommand;
class DumpSingleAsset extends AbstractCommand
{
protected function configure()
{
$this
->setName('assetic:dump_single_asset')
->setDescription('Dumps a single asset')
->addArgument('name', InputArgument::REQUIRED, 'The name of the asset')
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$name = $input->getArgument('name');
$this->dumpAsset($name, $output); // Inherited from AbstractCommand
}
}
Assetic docs shows a way more simple way to dump assets, but I could not find any documentation of the AsseticBundle internals, I just read the code of the Command.
Here's a solution using only configurations. In the config file leave bundles as:
bundles: []
This will not load the assets from any bundle unless you specify it manually.
use named assets as described here to load the assets you want individually.
http://symfony.com/doc/current/cookbook/assetic/asset_management.html#using-named-assets
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With