PHP code example of maximaster / twig.filewatcher

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

    

maximaster / twig.filewatcher example snippets



Maximaster\Tools\Twig\Filewatcher;
use Maximaster\Tools\Twig\FilewatcherExtension;
use Maximaster\Tools\Twig\WebpackExtension;

$watcher = new Filewatcher;
$watcher
    ->setInputDir(__DIR__.'/twig')
    ->setOutputDir(realpath(__DIR__.'/../'))
    ->setGlobalsFromFile(__DIR__.'/twig/.context.php')
    ->addExtension(new FilewatcherExtension)
    ->addExtension(new WebpackExtension(__DIR__.'/assets/build'))
    ->compile();