PHP code example of decodelabs / zest

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

    

decodelabs / zest example snippets


use DecodeLabs\Genesis;
use DecodeLabs\Zest\Manifest;

class ViewPlugin {

    public function apply(View $view): void {
        $manifest = Manifest::load(
            Genesis::$hub->getApplicationPath() . '/my-theme/manifest.json'
        );

        foreach ($manifest->getCssData() as $file => $attr) {
            /**
             * @var string $file - path to file
             * @var array $attr - array of tag attributes
             */
            $view->addCss($file, $attr);
        }

        foreach ($manifest->getHeadJsData() as $file => $attr) {
            $view->addHeadJs($file, $attr);
        }

        foreach ($manifest->getBodyJsData() as $file => $attr) {
            $view->addFootJs($file, $attr);
        }

        if ($manifest->isHot()) {
            $view->addBodyClass('zest-dev preload');
        }
    }
}