PHP code example of lightgear / asset

1. Go to this page and download the library: Download lightgear/asset 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/ */

    

lightgear / asset example snippets


'Lightgear\Asset\AssetServiceProvider'

'Asset' => 'Lightgear\Asset\Facades\Asset'

/**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $styles = array(
            'src/assets/styles',
            'src/assets/pure/pure/pure-min.css'
        );

        $asset = $this->app->make('asset');

        // register styles of a vendor package and assign them
        // to the default "general" group
        $asset->registerStyles($styles, 'vendor/package');

        // register styles of a vendor package and assign them
        // to the "frontend" group
        $asset->registerStyles($styles, 'vendor/package', 'frontend');

        // the same goes with scripts for whom you would use for example
        $asset->registerScripts(array('src/scripts')), 'vendor/package');
    }

Asset::registerStyles(array(
        'css/shared.less'
    )
);
or
Asset::registerScripts(array(
        'js/shared.js'
    )
);

// prints all the registered styles
{{ Asset::styles() }}

// prints only the "frontend" group
{{ Asset::styles('frontend') }}

// prints the "frontend" and "mygroup" groups
{{ Asset::styles(array('frontend', 'mygroup')) }}


{{ Asset::scripts() }}
bash
php artisan package:install lightgear/asset
bash
php artisan config:publish lightgear/asset
bash
php artisan asset:clean
bash
php artisan asset:generate