PHP code example of inspirecz / webloader
1. Go to this page and download the library: Download inspirecz/webloader 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' );
inspirecz / webloader example snippets
protected function createComponentCss ()
{
$files = new WebLoader\FileCollection(WWW_DIR . '/css' );
$files->addFiles(array (
'style.css' ,
WWW_DIR . '/colorbox/colorbox.css' ,
));
$files->addWatchFiles(Finder::findFiles('*.css' , '*.less' )->in(WWW_DIR . '/css' ));
$compiler = WebLoader\Compiler::createCssCompiler($files, WWW_DIR . '/temp' );
$compiler->addFilter(new WebLoader\Filter\VariablesFilter(array ('foo' => 'bar' )));
$compiler->addFilter(function ($code) {
return cssmin::minify($code, "remove-last-semicolon" );
});
$control = new WebLoader\Nette\CssLoader($compiler, '/webtemp' );
$control->setMedia('screen' );
return $control;
}
$webloaderExtension = new \WebLoader\Nette\Extension();
$webloaderExtension->install($configurator);
public $webLoader;
protected function createComponentCss ()
{
return $this ->webLoader->createCssLoader('default' );
}
protected function createComponentJs ()
{
return $this ->webLoader->createJavaScriptLoader('default' );
}