PHP code example of backfron / laravel-inline-assets

1. Go to this page and download the library: Download backfron/laravel-inline-assets library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

backfron / laravel-inline-assets example snippets


// Instead of this
<link rel="stylesheet" href="{{ asset('css/style.css') }}">
<script src="{{ asset('js/app.js') }}"></script>

// Write this
@inlineAsset('css/app.css')
@inlineAsset('js/app.js')

// Instead of this
<link rel="stylesheet" href="{{ asset('css/style.css') }}">
<script src="{{ asset('js/app.js') }}"></script>

// Write this
@inlineMix('css/app.css')
@inlineMix('js/app.js')

return [
    'inline' => [
        'production',
        'pre-production',
        'other-env',
        ... // ANY
        ... // OTHER
        ... // ENVIRONMENT
    ],
];
bash
php artisan vendor:publish --tag=laravel-inline-assets.config