Skip to content

Commit dea0b47

Browse files
Static Content Deploy - Add command line argument to disable JS Bundles
There were no way to disable JS bundles even if you don't use them. Disabling generation of JS bundles improves speed of Static Content Deploy and makes build package smaller.
1 parent db0dce6 commit dea0b47

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

app/code/Magento/Deploy/Console/DeployStaticOptions.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ class DeployStaticOptions
7878
*/
7979
const NO_JAVASCRIPT = 'no-javascript';
8080

81+
/**
82+
* Key for js-bundle option
83+
*/
84+
const NO_JS_BUNLDE = 'no-js-bundle';
85+
8186
/**
8287
* Key for css option
8388
*/
@@ -275,6 +280,12 @@ private function getSkipOptions()
275280
InputOption::VALUE_NONE,
276281
'Do not deploy JavaScript files.'
277282
),
283+
new InputOption(
284+
self::NO_JS_BUNLDE,
285+
null,
286+
InputOption::VALUE_NONE,
287+
'Do not deploy JavaScript bundle files.'
288+
),
278289
new InputOption(
279290
self::NO_CSS,
280291
null,

app/code/Magento/Deploy/Service/DeployStaticContent.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,20 @@ public function deploy(array $options)
120120
$deployI18n = $this->objectManager->create(DeployTranslationsDictionary::class, [
121121
'logger' => $this->logger
122122
]);
123+
foreach ($packages as $package) {
124+
if (!$package->isVirtual()) {
125+
$deployRjsConfig->deploy($package->getArea(), $package->getTheme(), $package->getLocale());
126+
$deployI18n->deploy($package->getArea(), $package->getTheme(), $package->getLocale());
127+
}
128+
}
129+
}
130+
131+
if ($options[Options::NO_JAVASCRIPT] !== true && $options[Options::NO_JS_BUNLDE] !== true ) {
123132
$deployBundle = $this->objectManager->create(Bundle::class, [
124133
'logger' => $this->logger
125134
]);
126135
foreach ($packages as $package) {
127136
if (!$package->isVirtual()) {
128-
$deployRjsConfig->deploy($package->getArea(), $package->getTheme(), $package->getLocale());
129-
$deployI18n->deploy($package->getArea(), $package->getTheme(), $package->getLocale());
130137
$deployBundle->deploy($package->getArea(), $package->getTheme(), $package->getLocale());
131138
}
132139
}

0 commit comments

Comments
 (0)