Skip to content

Commit 78dc6d4

Browse files
committed
fixed bug with assets version change
1 parent 93d067e commit 78dc6d4

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/AssetIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function push( $element ) {
7272
'name' => 'default',
7373
'src' => [],
7474
'dest' => '',
75-
'autoload' => false,
75+
'autoload' => true,
7676
'condition' => '',
7777
'type' => '',
7878
'assetType' => self::UNKNOWN,

src/JsonAssetsInfo.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ public function changeAssetVersion( $nameAsset ) {
284284
$this->newAssetDataArray[$nameAsset]['version'] = 1;
285285
}
286286

287-
//Yii::debug('Data: '.print_r($this->newAssetDataArray,true));
287+
//Yii::debug('Data: '.print_r($this->newAssetDataArray,true));
288+
289+
return $this->newAssetDataArray[$nameAsset]['version'];
288290
}
289291
}

src/Module.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ protected function onEndPage( \yii\web\View &$view ) {
6464
$this->checkForChanges( $asset, $view );
6565

6666
if( $this->assetsAddLoader )
67-
$this->addLoader();
67+
$this->addLoader( $asset );
6868
}
6969

7070
public function checkForChanges( AssetIterator &$asset, \yii\web\View &$view ) {
@@ -137,7 +137,11 @@ public function checkForChanges( AssetIterator &$asset, \yii\web\View &$view ) {
137137
}
138138

139139
if( $need_rebuild ) {
140-
$this->jsonData->changeAssetVersion( $asset->name() );
140+
$new_version = $this->jsonData->changeAssetVersion( $asset->name() );
141+
142+
$asset->setVersion( $new_version );
143+
$this->assetsToWatch[$asset->name()]['version'] = $new_version;
144+
141145
$changes_cfg = true;
142146
}
143147

@@ -190,7 +194,7 @@ public function unregisterAssets( \yii\web\View &$view ) {
190194
}
191195
}
192196

193-
public function addLoader() {
197+
public function addLoader( AssetIterator &$asset ) {
194198
$loader = new AssetLoader( $this->assetsToWatch );
195199
$pathEx = $loader->getScriptPathEx();
196200
$script = false;

0 commit comments

Comments
 (0)