Permalink
Browse files

Bundlers will not output a html comment if they refreshed.

  • Loading branch information...
1 parent 77a6e17 commit 46bb44e45af99be46d57325100aa63243fdd3eea @balupton balupton committed Nov 10, 2010
Showing with 29 additions and 5 deletions.
  1. +11 −2 lib/Bal/View/Helper/HeadLinkBundler.php
  2. +18 −3 lib/Bal/View/Helper/HeadScriptBundler.php
@@ -232,11 +232,20 @@ public function toString ($indent = null) {
}
# Use the Cached File
- $this->addFile($compiledFileUrl.'?'.$compiledFilemtime);
+ $compiledUrl = $compiledFileUrl.'?'.$compiledFilemtime;
+ $this->addFile($compiledUrl);
}
# Let's hand back to our parent
- return parent::toString($indent);
+ $result = parent::toString($indent);
+
+ # Add Refresh Status
+ if ( $refresh ) {
+ $result .= "\n<!--[Styles Bundled + Refreshed]-->\n";
+ }
+
+ # Return result
+ return $result;
}
}
@@ -198,7 +198,13 @@ public function toString ($indent = null) {
# Should we refresh?
if ( $filemtime >= $cacheFilemtime ) {
$refresh = true;
- file_put_contents($cachePath,file_get_contents($url));
+ if ( strstr($url,'?') || !$path ) {
+ $contents = file_get_contents($url);
+ }
+ else {
+ $contents = file_get_contents($path);
+ }
+ file_put_contents($cachePath,$contents);
}
elseif ( $filemtime >= $compiledFilemtime ) {
$refresh = true;
@@ -229,11 +235,20 @@ public function toString ($indent = null) {
}
# Use the Cached File
- $this->addFile($compiledFileUrl.'?'.$compiledFilemtime);
+ $compiledUrl = $compiledFileUrl.'?'.$compiledFilemtime;
+ $this->addFile($compiledUrl);
}
# Let's hand back to our parent
- return parent::toString($indent);
+ $result = parent::toString($indent);
+
+ # Add Refresh Status
+ if ( $refresh ) {
+ $result .= "\n<!--[Scripts Bundled + Refreshed]-->\n";
+ }
+
+ # Return result
+ return $result;
}
}

0 comments on commit 46bb44e

Please sign in to comment.