Skip to content

Commit ea7a057

Browse files
committed
Merge pull request #8 from publiux/release-1.0.2
Release 1.0.2
2 parents 174e981 + 79d7479 commit ea7a057

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

readme.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ $ ./vendor/bin/phpunit
245245

246246
## Support
247247

248-
[On Github](https://github.com/publiux/laravelcdn/issues)
248+
Please request support or submit issues [via Github](https://github.com/publiux/laravelcdn/issues)
249249

250250

251251
## Contributing
@@ -270,5 +270,8 @@ The MIT License (MIT). Please see [License File](https://github.com/publiux/lara
270270

271271
## Changelog
272272

273+
#### v1.0.2
274+
- Fixed bug where the elixir function was inadvertently omitted from the release.
275+
273276
#### v1.0.1
274277
- Allow configuration using environment values

src/Publiux/laravelcdn/CdnFacade.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,29 @@ public function asset($path)
8181
return $this->generateUrl($path, 'public/');
8282
}
8383

84+
/**
85+
* this function will be called from the 'views' using the
86+
* 'Cdn' facade {{Cdn::elixir('')}} to convert the elixir generated file path into
87+
* it's CDN url.
88+
*
89+
* @param $path
90+
*
91+
* @throws Exceptions\EmptyPathException, \InvalidArgumentException
92+
*
93+
* @return mixed
94+
*/
95+
public function elixir($path)
96+
{
97+
static $manifest = null;
98+
if (is_null($manifest)) {
99+
$manifest = json_decode(file_get_contents(public_path('build/rev-manifest.json')), true);
100+
}
101+
if (isset($manifest[$path])) {
102+
return $this->generateUrl('build/'.$manifest[$path], 'public/');
103+
}
104+
throw new \InvalidArgumentException("File {$path} not defined in asset manifest.");
105+
}
106+
84107
/**
85108
* this function will be called from the 'views' using the
86109
* 'Cdn' facade {{Cdn::path('')}} to convert the path into

0 commit comments

Comments
 (0)