Run add-on extension WebLoader

Notice: This thread is very old.
majak
Member | 4
+
0
-

Hi,

I know this will be very basic topic, but after some hours I realy dont know how to run WebLoader.

Explanation of problem:

There is add-on WebLoader by Jan Marek: https://componette.org/search/?….
I understand the code and there is an example, thats ok.

  1. Question one: Where to put downloaded WebLoader library? I suggest it should be in vendor directory. Observation: I had Nette (dont know which version) two months old and there was not any vendor dir. I downloaded new version today and voila vendor is there. Thats good, Nette is making progress, but it should be documented!!!

Ok I put WebLoader to vendor.
And I added some lines to bootstrap:

require __DIR__ . '/../vendor/WebLoader/Nette/Extension.php';
...
$webloaderExtension = new \WebLoader\Nette\Extension();
$webloaderExtension->install($configurator);

Also I put these lines to config.neon:

services:
    wlCssFilter: WebLoader\Filter\CssUrlsFilter(%wwwDir%)
    lessFilter: WebLoader\Filter\LessFilter

webloader:
    css:
        default:
            files:
                - style.css
                - {files: ["*.css", "*.less"], from: %appDir%/presenters} ## Nette\Utils\Finder support
            filters:
                - @wlCssFilter
            fileFilters:
                - @lessFilter

But still I get this error:
Class WebLoader\LoaderFactory used in service ‘webloader.factory’ has not been found or is not instantiable.

So, what did I understand badly? Where is the problem?

P.S.: I read DI Container Extension.

Thanks for advice.

Last edited by majak (2014-04-21 17:38)

Tomáš Votruba
Moderator | 1114
+
0
-

Hi, try register extension in extensions section in config. If you have some troubles with addon, check it's github readme (usually it's more up to date).

In particular:

extensions:
    webloader: WebLoader\Nette\Extension

and remove that code from bootstrap.php.

majak
Member | 4
+
0
-

Thanks, but result is same.

This is what I have in config.neon:

php:
	date.timezone: Europe/Prague
	# zlib.output_compression: yes


nette:
	application:
		errorPresenter: Error
		mapping:
			*: App\*Module\Presenters\*Presenter

	session:
		expiration: 14 days


services:
	- App\Model\UserManager
	- App\RouterFactory
	router: @App\RouterFactory::createRouter

extensions:
	webloader: WebLoader\Nette\Extension

and I removed added code from bootstrap except the require:

<?php

require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/../vendor/WebLoader/Nette/Extension.php';

$configurator = new Nette\Configurator;

//$configurator->setDebugMode(TRUE);  // debug mode MUST NOT be enabled on production server
$configurator->enableDebugger(__DIR__ . '/../log');

$configurator->setTempDirectory(__DIR__ . '/../temp');

$configurator->createRobotLoader()
	->addDirectory(__DIR__)
	->addDirectory(__DIR__ . '/../vendor/others')
	->register();

$configurator->addConfig(__DIR__ . '/config/config.neon');
$configurator->addConfig(__DIR__ . '/config/config.local.neon');

$container = $configurator->createContainer();

return $container;

Also cleaned a cache.

I still get a error:

Nette\DI\ServiceCreationException

Class WebLoader\LoaderFactory used in service ‘webloader.factory’ has not been found or is not instantiable.

David Matějka
Moderator | 6445
+
0
-

Use composer for webloader installation

Last edited by matej21 (2014-04-21 21:31)

matopeto
Member | 395
+
0
-

Yes, use composer for Webloader and also for Nette.