PHP code example of janmarek / webloader
1. Go to this page and download the library: Download janmarek/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');
/* Start to develop here. Best regards https://php-download.com/ */
janmarek / 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);
/** @var \WebLoader\Nette\LoaderFactory @inject */
public $webLoader;
/** @return CssLoader */
protected function createComponentCss()
{
return $this->webLoader->createCssLoader('default');
}
/** @return JavaScriptLoader */
protected function createComponentJs()
{
return $this->webLoader->createJavaScriptLoader('default');
}