Skip to content

Commit b67bc1e

Browse files
authored
Merge pull request #12 from magefan/11052-speed-optimization-extension-v2
11052 speed optimization extension v2
2 parents a422095 + 53d6b99 commit b67bc1e

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

Diff for: Model/Config.php

+4-8
Original file line numberDiff line numberDiff line change
@@ -115,24 +115,20 @@ public function isBundlingEnabled(string $storeId = null): bool
115115

116116
/**
117117
* Retrieve true if bundling optimization is enabled
118-
*
119-
* @param string|null $storeId
120118
* @return bool
121119
*/
122-
public function isBundlingOptimizationEnabled(string $storeId = null): bool
120+
public function isBundlingOptimizationEnabled(): bool
123121
{
124-
return (bool)$this->getConfig(self::XML_PATH_JAVASCRIPT_BUNDLING_OPTIMIZATION_ENABLED, $storeId);
122+
return (bool)$this->getConfig(self::XML_PATH_JAVASCRIPT_BUNDLING_OPTIMIZATION_ENABLED);
125123
}
126124

127125
/**
128126
* Retrieve included in bundling JS
129-
*
130-
* @param string|null $storeId
131127
* @return string
132128
*/
133-
public function getIncludedInBundling(string $storeId = null): string
129+
public function getIncludedInBundling(): string
134130
{
135-
return (string)$this->getConfig(self::XML_PATH_JAVASCRIPT_BUNDLING_INCLUDED_IN_BUNDLING, $storeId);
131+
return (string)$this->getConfig(self::XML_PATH_JAVASCRIPT_BUNDLING_INCLUDED_IN_BUNDLING);
136132
}
137133

138134
/**

Diff for: Plugin/Deploy/Package/Bundle/RequireJsPlugin.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public function __construct(
3838
*/
3939
public function aroundAddFile(RequireJs $subject, callable $proceed, $filePath, $sourcePath, $contentType)
4040
{
41+
$jsOptimization = $this->config->isEnabled() && $this->config->isBundlingOptimizationEnabled();
4142

42-
$jsOptimization = $this->config->isBundlingEnabled() && $this->config->isEnabled();
4343
if ($jsOptimization) {
4444
$allowedFiles = $this->getAllowedFiles();
4545

@@ -55,6 +55,7 @@ public function aroundAddFile(RequireJs $subject, callable $proceed, $filePath,
5555
return true;
5656
}
5757
}
58+
5859
return $proceed($filePath, $sourcePath, $contentType);
5960
}
6061

Diff for: etc/adminhtml/system.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@
6969
<backend_model>Magefan\RocketJavaScript\Model\Config\Backend\DevSettings</backend_model>
7070
<comment>Static content deployment is a requirement after option change</comment>
7171
</field>
72-
<field id="enable_js_bundling_optimization" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="20" translate="label" type="select" canRestore="1">
72+
<field id="enable_js_bundling_optimization" showInDefault="1" showInStore="0" showInWebsite="0" sortOrder="20" translate="label" type="select" canRestore="1">
7373
<label>Enable Bundling Optimization</label>
7474
<depends>
7575
<field id="enabled">1</field>
7676
</depends>
7777
<comment>Static content deployment is a requirement after option change</comment>
7878
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
7979
</field>
80-
<field id="included_in_bundling" showInDefault="1" showInStore="1" showInWebsite="1" sortOrder="30" translate="label" type="textarea" canRestore="1">
80+
<field id="included_in_bundling" showInDefault="1" showInStore="0" showInWebsite="0" sortOrder="30" translate="label" type="textarea" canRestore="1">
8181
<label>Included In Bundling</label>
8282
<depends>
8383
<field id="enabled">1</field>

0 commit comments

Comments
 (0)