Laravel-Backpack / basset

Better asset helpers for Laravel apps.
MIT License
151 stars 10 forks source link

[Feature] Support for SVGs, images and more #91

Closed promatik closed 3 months ago

promatik commented 10 months ago

Fix for https://github.com/Laravel-Backpack/basset/issues/84.

1) Added FileOutput helper. 2) Basset now outputs the most common file extensions.

Basset Output is now much more organized, and all the available output file extensions are in separate blade files πŸŽ‰

How fancy is that!? image

tabacitu commented 10 months ago

Awesome! Muuuuch cleaner, I like it. Now let's please document and test this. Steps:

promatik commented 10 months ago

We improve the section about the @basset() directive, to list all the file types it now treats, and what the output is for each one.

Added a table with the know extensions πŸ™Œ

image

promatik commented 10 months ago

Two-three people test this.

Assigned here @pxpm, @karandatwani92, @phpfour, if any of you guys can, please give this a quick test πŸ™Œ

karandatwani92 commented 10 months ago
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">

    <span>CSS & JS</span>
    @basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme/Material/css/theme.min.css')
    @basset('https://unpkg.com/jquery@3.6.4/dist/jquery.min.js')

    <span>Image</span>
    @basset('https://backpackforlaravel.com/presentation/img/backpack/logos/backpack_logo.svg')

    <span>Audio/Video</span>
    @basset(base_path('vendor/studio-42/elfinder/sounds/rm.wav'))
    @basset('https://download.samplelib.com/mp4/sample-5s.mp4')

    <span>ICO</span>
    @basset('https://www.learningcontainer.com/wp-content/uploads/2020/09/Sample-ICO-file-Download-for-testing.ico')

    <span>PDF</span>
    @basset('https://www.africau.edu/images/default/sample.pdf')

    <span>VTT</span>
    @basset('https://gist.githubusercontent.com/samdutton/ca37f3adaf4e23679957b8083e061177/raw/e19399fbccbc069a2af4266e5120ae6bad62699a/sample.vtt')

</html>

Output

Screenshot 2023-09-13 at 7 56 32 PM

.env

APP_ENV=local
APP_DEBUG=true
APP_URL=http://backpack-demo.test
ASSET_URL=http://backpack-demo.test
promatik commented 10 months ago

Hey @karandatwani92, by default on local development dev_mode is active, so yes, no cache.

'dev_mode' => env('BASSET_DEV_MODE', env('APP_ENV') === 'local'),

In order to test cache locally you should add BASSET_DEV_MODE=false to your .env.