Skip to content

Commit

Permalink
add: allow to merge asset depedencies with custom depdencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ravinderk committed Feb 9, 2023
1 parent fd218d5 commit a8661c7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion includes/classes/EnqueueScript.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,14 @@ public function loadInFooter(): EnqueueScript {
*
* @return $this
*/
public function dependencies( array $scriptDependencies ): EnqueueScript {
public function dependencies( array $scriptDependencies, $addDependenciesFromAssets = true ): EnqueueScript {
$this->scriptDependencies = $scriptDependencies;

if ( $addDependenciesFromAssets ) {
$assetFileData = $this->getAssetFileData();
$this->scriptDependencies = array_merge( $this->scriptDependencies, $assetFileData['dependencies'] );
}

return $this;
}

Expand Down

0 comments on commit a8661c7

Please sign in to comment.