-
Notifications
You must be signed in to change notification settings - Fork 0
/
LessExtension.php
44 lines (37 loc) · 1.05 KB
/
LessExtension.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/*
* This file is part of the Less plugin for carew.
*
* (c) Francis Besset <francis.besset@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace FrancisBesset\Carew\Less;
use Carew\Carew;
use Carew\ExtensionInterface;
use FrancisBesset\Carew\Less\EventListener\LessListener;
use lessc;
/**
* @author Francis Besset <francis.besset@gmail.com>
*/
class LessExtension implements ExtensionInterface
{
public function register(Carew $carew)
{
$container = $carew->getContainer();
$config = $container['config']['less'];
foreach ($container['themes'] as $theme) {
if (is_file($theme.'/'.$config['input'])) {
$input = $theme.'/'.$config['input'];
break;
}
}
$eventDispatcher = $carew->getEventDispatcher()->addSubscriber(new LessListener(
new lessc(),
$container['filesystem'],
$input,
$config['output']
));
}
}