Skip to content

Commit

Permalink
Do not add hashes to asset directory
Browse files Browse the repository at this point in the history
  • Loading branch information
g105b committed Jan 10, 2015
1 parent b2de704 commit 4160bf6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/ClientSide/FileOrganiser.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ public function purgeStaticWwwFiles() {
foreach(new \DirectoryIterator(Path::get(Path::WWW)) as $item) {
$filename = $item->getFilename();


if($filename === $assetDirName
|| strpos($filename, $scriptDirName . "-") === 0
|| strpos($filename, $styleDirName . "-") === 0) {
Expand Down Expand Up @@ -233,13 +232,6 @@ public function copyAsset() {
return $copyCount;
}

private function writeStaticFingerprint($fingerprint) {
if(!is_dir(dirname($this->staticFingerprintFile))) {
mkdir(dirname($this->staticFingerprintFile), 0775, true);
}
file_put_contents($this->staticFingerprintFile, $fingerprint);
}

/**
*
*/
Expand All @@ -260,6 +252,13 @@ public function copyAssetCallback($file, $iterator, &$out) {
}
}

private function writeStaticFingerprint($fingerprint) {
if(!is_dir(dirname($this->staticFingerprintFile))) {
mkdir(dirname($this->staticFingerprintFile), 0775, true);
}
file_put_contents($this->staticFingerprintFile, $fingerprint);
}

/**
* Recursively iterate over all files within given directories and build up a
* hash of their contents and file names.
Expand Down
11 changes: 11 additions & 0 deletions src/ClientSide/PageManifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ public function __construct(Node $domHead, $request, $response) {
public function generatePathDetails() {
$this->nodeList = $this->domHead->xpath(self::$xpathQuery);

// Do not add nodes that reference the asset directory.
foreach ($this->nodeList->nodeArray as $i => $node) {
$source = $node->getAttribute(
$this->sourceAttribute[$node->tagName]);
$source = strtolower($source);
if(strpos($source, "/asset") === 0) {
unset($this->nodeList->nodeArray[$i]);
}
}
$this->nodeList->nodeArray = array_values($this->nodeList->nodeArray);

$pathDetails = new PathDetails($this->nodeList);
return $pathDetails;
}
Expand Down

0 comments on commit 4160bf6

Please sign in to comment.