Yes, a known problem ... In our production process, we ended up with such a block in the bin/vendors script:
if (in_array('--env=dev', $argv)) { system(sprintf('%s %s assets:install --symlink %s', $interpreter, escapeshellarg($rootDir . '/app/console'), escapeshellarg($rootDir . '/web/'))); system(sprintf('%s %s assetic:dump --env=dev', $interpreter, escapeshellarg($rootDir . '/app/console'))); system(sprintf('%s %s myVendor:assets:install --symlink ', $interpreter, escapeshellarg($rootDir . '/app/console'))); } else { system(sprintf('%s %s assets:install %s', $interpreter, escapeshellarg($rootDir . '/app/console'), escapeshellarg($rootDir . '/web/'))); system(sprintf('%s %s assetic:dump --env=prod --no-debug', $interpreter, escapeshellarg($rootDir . '/app/console'))); system(sprintf('%s %s myVendor:assets:install ', $interpreter, escapeshellarg($rootDir . '/app/console'))); }
As you can see, we have defined our console command, which installs assets into a web folder after installing and resetting Symfony assets. In the MyVendorCommand script, we do something like this:
$version = $this->getContainer()->getParameter('your_version_parameter'); $assetsInstallCommand = $this->getApplication()->find('assets:install'); $commandOptions = $input->getOptions(); $assetsInstallArguments = array( 'command' => 'assets:install', 'target' => 'web/version-' . $version, '--symlink' => $commandOptions['symlink'] ); $assetsInstallInput = new ArrayInput($assetsInstallArguments); $returnCode = $assetsInstallCommand->run($assetsInstallInput, $output);
source share