Skip to content

Commit

Permalink
Delegate cache busting query string to the UrlGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Stanfield authored and stanfieldr committed Apr 24, 2016
1 parent cd1bc47 commit 9e00ed4
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/JavascriptRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,16 @@ public function setUrlGenerator($url)
*/
public function renderHead()
{
$jsModified = $this->getModifiedTime('js');
$cssModified = $this->getModifiedTime('css');

$html = '';
$html .= sprintf(
'<link rel="stylesheet" type="text/css" href="%s?%s">' . "\n",
route('debugbar.assets.css'),
$cssModified
);
$html .= sprintf(
'<script type="text/javascript" src="%s?%s"></script>' . "\n",
route('debugbar.assets.js'),
$jsModified
);
$cssRoute = route('debugbar.assets.css', [
'v' => $this->getModifiedTime('css')
]);

$jsRoute = route('debugbar.assets.js', [
'v' => $this->getModifiedTime('js')
]);

$html = "<link rel='stylesheet' type='text/css' href='{$cssRoute}'>";
$html .= "<script type='text/javascript' src='{$jsRoute}'></script>";

if ($this->isJqueryNoConflictEnabled()) {
$html .= '<script type="text/javascript">jQuery.noConflict(true);</script>' . "\n";
Expand Down

0 comments on commit 9e00ed4

Please sign in to comment.