Added support for fetching remote assets. #112

wants to merge 5 commits into


None yet

2 participants


The paths[] array now accepts remote paths.

For example:

paths[] =

files[] = jquery/latest/jquery.min.js

This will fetch and integrate it into mybuild.js. Build will fail if the file cannot be read, as it happens with local files.

Of course this is compatible with local paths, filters and any other stuff that worked previously.

For now, just HTTP is supported, but it can be easily upgraded. PHP5 is required, as stream_get_contents() is used.

@markstory markstory commented on an outdated diff May 22, 2012
@@ -96,13 +114,26 @@ public function find($file) {
return $file;
foreach ($this->_paths as $path) {
- if (file_exists($path . $file)) {
- return $path . $file;
+ if ($ds = $this->isRemote($path)) {
+ $file = $this->_normalizePath($file, $ds);
+ $full_path = $path . $file;
markstory May 22, 2012 Owner

Variables should be in camelBacked format.

@markstory markstory commented on an outdated diff May 22, 2012
@@ -230,9 +230,9 @@ protected function _parseExtensionDef($target) {
* @return string constants replaced
protected function _replacePathConstants($path) {
- $result = strtr($path, $this->constantMap);
- $result = str_replace('/', DS, $result);
- return $result;
+ $result = strtr($path, $this->constantMap);
+ //$result = str_replace('/', DS, $result); // If $path is remote this will screw it up. I've moved it to AssetScanner::_normalizePaths().
markstory May 22, 2012 Owner

Just remove commented out code :)


Merged in [ed2dd67]

@markstory markstory closed this May 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment