Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bryanjhv/laravel-blade-cdn
A Blade directive for getting asset URLs according to app environment.
https://github.com/bryanjhv/laravel-blade-cdn
Last synced: about 2 months ago
JSON representation
A Blade directive for getting asset URLs according to app environment.
- Host: GitHub
- URL: https://github.com/bryanjhv/laravel-blade-cdn
- Owner: bryanjhv
- License: mit
- Created: 2016-08-14T01:15:16.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-11-20T07:40:09.000Z (about 8 years ago)
- Last Synced: 2024-11-10T20:45:19.417Z (2 months ago)
- Language: PHP
- Size: 4.88 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Laravel Blade CDN
A [Blade][blade] directive for getting asset URLs according to app environment.
## Installation
Require this package with [Composer][composer] using the following command
```bash
composer require bryanjhv/laravel-blade-cdn
```After updating Composer, add the service provider to the `providers` array in
your `config/app.php` file:```php
Bryanjhv\BladeCdn\BladeCdnServiceProvider::class,
```Finally, publish the config file, so you can configure your own CDN aliases and
prefix:```bash
php artisan vendor:publish --provider="Bryanjhv\BladeCdn\BladeCdnServiceProvider" --tag=config
```## Usage
**Important**: First at all, please remove all your cached views, using:
```bash
php artisan view:clear
```The service provider makes the `@cdn` Blade directive available, so you can use
it like so (working on `resources/views/sample.blade.php`):```blade
```
The above code will be expanded, in production, using the default configuration
file the package ships with, to:```php
```
Or, in any other environment, to:
```php
```
Of course, you may define any custom alias and prefix after publishing the
configuration by editing the `config/blade-cdn.php` file.## License
This project is released under the MIT license.
[blade]: https://laravel.com/docs/blade
[composer]: https://getcomposer.org