Skip to content

Commit edcbcc5

Browse files
committed
Add the assets manager
1 parent bc55aba commit edcbcc5

File tree

5 files changed

+12
-103
lines changed

5 files changed

+12
-103
lines changed

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1+
composer.lock
12
composer.phar
23
/vendor/
3-
4-
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
5-
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
6-
# composer.lock

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
Pug template engine for Symfony
33

44
## Install
5-
In the root directory of your Symfony project, open a
6-
terminal and enter:
5+
In the root directory of your Symfony project, open a terminal and enter:
76
```shell
87
composer require pug-php/pug-symfony
98
```

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"description": "Pug template engine for Symfony",
77
"type": "library",
88
"require": {
9-
"pug-php/pug": "^2.0"
9+
"pug-php/pug": "^2.0",
10+
"pug-php/pug-assets": "^1.0"
1011
},
1112
"license": "MIT",
1213
"authors": [

composer.lock

Lines changed: 0 additions & 95 deletions
This file was deleted.

src/Jade/JadeSymfonyEngine.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class JadeSymfonyEngine implements EngineInterface, \ArrayAccess
1010
protected $container;
1111
protected $jade;
1212
protected $helpers;
13+
protected $assets;
1314
protected $kernel;
1415

1516
public function __construct($kernel)
@@ -23,16 +24,22 @@ public function __construct($kernel)
2324
if (!file_exists($cache)) {
2425
mkdir($cache);
2526
}
27+
$container = $kernel->getContainer();
28+
$environment = $container->getParameter('kernel.environment');
2629
$this->jade = new Jade(array(
2730
'prettyprint' => $kernel->isDebug(),
2831
'extension' => array('.pug', '.jade'),
29-
'cache' => $cache
32+
'cache' => substr($environment, 0, 3) === 'dev' ? $cache : false,
33+
'assetDirectory' => __DIR__ . '/../Resources/assets',
34+
'outputDirectory' => __DIR__ . '/../../../web',
35+
'environment' => $environment,
3036
));
3137
foreach (array_slice(func_get_args(), 1) as $helper) {
3238
$name = preg_replace('`^(?:.+\\\\)([^\\\\]+?)(?:Helper)?$`', '$1', get_class($helper));
3339
$name = strtolower(substr($name, 0, 1)) . substr($name, 1);
3440
$this->helpers[$name] = $helper;
3541
}
42+
$this->assets = new Assets($this->jade);
3643
}
3744

3845
public function getOption($name)

0 commit comments

Comments
 (0)