Skip to content

Commit

Permalink
Add the assets manager
Browse files Browse the repository at this point in the history
  • Loading branch information
kylekatarnls committed Jul 29, 2016
1 parent bc55aba commit edcbcc5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 103 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
composer.lock
composer.phar
/vendor/

# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
Pug template engine for Symfony

## Install
In the root directory of your Symfony project, open a
terminal and enter:
In the root directory of your Symfony project, open a terminal and enter:
```shell
composer require pug-php/pug-symfony
```
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"description": "Pug template engine for Symfony",
"type": "library",
"require": {
"pug-php/pug": "^2.0"
"pug-php/pug": "^2.0",
"pug-php/pug-assets": "^1.0"
},
"license": "MIT",
"authors": [
Expand Down
95 changes: 0 additions & 95 deletions composer.lock

This file was deleted.

9 changes: 8 additions & 1 deletion src/Jade/JadeSymfonyEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class JadeSymfonyEngine implements EngineInterface, \ArrayAccess
protected $container;
protected $jade;
protected $helpers;
protected $assets;
protected $kernel;

public function __construct($kernel)
Expand All @@ -23,16 +24,22 @@ public function __construct($kernel)
if (!file_exists($cache)) {
mkdir($cache);
}
$container = $kernel->getContainer();
$environment = $container->getParameter('kernel.environment');
$this->jade = new Jade(array(
'prettyprint' => $kernel->isDebug(),
'extension' => array('.pug', '.jade'),
'cache' => $cache
'cache' => substr($environment, 0, 3) === 'dev' ? $cache : false,
'assetDirectory' => __DIR__ . '/../Resources/assets',
'outputDirectory' => __DIR__ . '/../../../web',
'environment' => $environment,
));
foreach (array_slice(func_get_args(), 1) as $helper) {
$name = preg_replace('`^(?:.+\\\\)([^\\\\]+?)(?:Helper)?$`', '$1', get_class($helper));
$name = strtolower(substr($name, 0, 1)) . substr($name, 1);
$this->helpers[$name] = $helper;
}
$this->assets = new Assets($this->jade);
}

public function getOption($name)
Expand Down

0 comments on commit edcbcc5

Please sign in to comment.