Skip to content

Commit

Permalink
Update Facade references in docs to avoid confusion
Browse files Browse the repository at this point in the history
It gets auto-registered as CDN in 5.5+, so updated docs to be consistent
no matter the version. Even if you add the service provider yourself
  • Loading branch information
Ben committed Feb 4, 2018
1 parent dc56a3b commit 295935b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Laravel 5.4 and below: Add the service provider and facade to `config/app.php`:
```php
'aliases' => array(
//...
'Cdn' => Publiux\laravelcdn\Facades\CdnFacadeAccessor::class
'CDN' => Publiux\laravelcdn\Facades\CdnFacadeAccessor::class
),
```

Expand Down Expand Up @@ -233,32 +233,32 @@ CAUTION: This will erase your entire bucket. This may not be what you want if yo

#### Load Assets

Use the facade `Cdn` to call the `Cdn::asset()` function.
Use the facade `CDN` to call the `CDN::asset()` function.

*Note: the `asset` works the same as the Laravel `asset` it start looking for assets in the `public/` directory:*

```blade
{{Cdn::asset('assets/js/main.js')}} // example result: https://js-bucket.s3.amazonaws.com/public/assets/js/main.js
{{CDN::asset('assets/js/main.js')}} // example result: https://js-bucket.s3.amazonaws.com/public/assets/js/main.js
{{Cdn::asset('assets/css/style.css')}} // example result: https://css-bucket.s3.amazonaws.com/public/assets/css/style.css
{{CDN::asset('assets/css/style.css')}} // example result: https://css-bucket.s3.amazonaws.com/public/assets/css/style.css
```
*Note: the `elixir` works the same as the Laravel `elixir` it loads the manifest.json file from build folder and choose the correct file revision generated by gulp:*
```blade
{{Cdn::elixir('assets/js/main.js')}} // example result: https://js-bucket.s3.amazonaws.com/public/build/assets/js/main-85cafe36ff.js
{{CDN::elixir('assets/js/main.js')}} // example result: https://js-bucket.s3.amazonaws.com/public/build/assets/js/main-85cafe36ff.js
{{Cdn::elixir('assets/css/style.css')}} // example result: https://css-bucket.s3.amazonaws.com/public/build/assets/css/style-2d558139f2.css
{{CDN::elixir('assets/css/style.css')}} // example result: https://css-bucket.s3.amazonaws.com/public/build/assets/css/style-2d558139f2.css
```
*Note: the `mix` works the same as the Laravel 5.4 `mix` it loads the mix-manifest.json file from public folder and choose the correct file revision generated by webpack:*
```blade
{{Cdn::mix('/js/main.js')}} // example result: https://js-bucket.s3.amazonaws.com/public/js/main-85cafe36ff.js
{{CDN::mix('/js/main.js')}} // example result: https://js-bucket.s3.amazonaws.com/public/js/main-85cafe36ff.js
{{Cdn::mix('/css/style.css')}} // example result: https://css-bucket.s3.amazonaws.com/public/css/style-2d558139f2.css
{{CDN::mix('/css/style.css')}} // example result: https://css-bucket.s3.amazonaws.com/public/css/style-2d558139f2.css
```

To use a file from outside the `public/` directory, anywhere in `app/` use the `Cdn::path()` function:
To use a file from outside the `public/` directory, anywhere in `app/` use the `CDN::path()` function:

```blade
{{Cdn::path('private/something/file.txt')}} // example result: https://css-bucket.s3.amazonaws.com/private/something/file.txt
{{CDN::path('private/something/file.txt')}} // example result: https://css-bucket.s3.amazonaws.com/private/something/file.txt
```


Expand Down

0 comments on commit 295935b

Please sign in to comment.