File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments