Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 771f11b

Browse files
Robin Lehrmannrobinlehrmann
Robin Lehrmann
authored andcommitted
added clean option to assets install command
1 parent 22192b1 commit 771f11b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ protected function configure()
5858
))
5959
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it')
6060
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
61+
->addOption('no-cleanup', null, InputOption::VALUE_NONE, 'Do not remove the assets of the bundles that no longer exist')
6162
->setDescription('Installs bundles web assets under a public directory')
6263
->setHelp(<<<'EOT'
6364
The <info>%command.name%</info> command installs bundle assets into a given
@@ -162,7 +163,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
162163
}
163164
}
164165
// remove the assets of the bundles that no longer exist
165-
if (is_dir($bundlesDir)) {
166+
if (!$input->getOption('no-cleanup') && is_dir($bundlesDir)) {
166167
$dirsToRemove = Finder::create()->depth(0)->directories()->exclude($validAssetDirs)->in($bundlesDir);
167168
$this->filesystem->remove($dirsToRemove);
168169
}

0 commit comments

Comments
 (0)