PHP code example of crypto_scythe / bundledassets

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

    

crypto_scythe / bundledassets example snippets


# Add module class to Modules configuration
CryptoScythe\BundledAssets\Module::class,

# Add config provider class to configuration
CryptoScythe\BundledAssets\ConfigProvider::class,

# global.php
use CryptoScythe\BundledAssets\ConfigProvider as BundledAssetsConfigProvider;

BundledAssetsConfigProvider::GLOBAL_CONFIG_KEY_VIEW_HELPER_CONFIG => [
    BundledAssetsConfigProvider::class => [
        BundledAssetsConfigProvider::CONFIG_KEY_CACHE_PATH => 'data/bundled_assets_cache.php', # Path to cache file, mostly production 
            BundledAssetsConfigProvider::CONFIG_KEY_MANIFESTS => [ # Hash map of manifest files
                BundledAssetsConfigProvider::CONFIG_KEY_DEFAULT_MANIFEST => 'data/webpack-assets.json',
                'other_manifest' => 'data/other-assets.json', # [optional] You can use multiple asset manifests
        ],
    ],
],

$this->bundledAssets('entry_point'); # Uses assets from default
$this->bundledAssets('some_other_entry_point', 'other_manifest'); # Uses additionally defined manifest

{
    "main": {
        "js": [
            "some_js_asset.12345.js",
            "some_other_js_asset.54321.js"
        ],
        "css": [
            "some_css_asset.12345.css",
            "another_css_asset.abcdef.css"
        ],
    },
    "another": {
        # even more of the same
    }
}