init without trunk

This commit is contained in:
Kevin Adametz 2020-07-09 12:49:32 +02:00
parent ed24ac4994
commit bb809e7233
14652 changed files with 177862 additions and 94817 deletions

View file

@ -0,0 +1,3 @@
phpunit.xml
vendor
composer.lock

View file

@ -0,0 +1,41 @@
language: php
sudo: false
cache:
directories:
- $HOME/.composer/cache/files
php:
- 5.3
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm
matrix:
fast_finish: true
include:
- php: 5.3
env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_DEPRECATIONS_HELPER=weak
# Test against Symfony LTS versions
- php: 5.6
env: SYMFONY_VERSION=2.3.*
- php: 5.6
env: SYMFONY_VERSION=2.7.*
# Test against dev versions
- php: 5.6
env: DEPENDENCIES=dev
allow_failures:
- php: hhvm
- env: DEPENDENCIES=dev
install:
- if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
- if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi;
# Spork 0.3 is not compatible with HHVM
- if [ "$TRAVIS_PHP_VERSION" = "hhvm" ]; then composer remove --dev --no-update kriswallsmith/spork; fi;
- composer update $COMPOSER_FLAGS
script: phpunit -v

View file

@ -0,0 +1,39 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle;
use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Assetic integration.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class AsseticBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
$container->addCompilerPass(new Compiler\TemplateResourcesPass());
$container->addCompilerPass(new Compiler\CheckClosureFilterPass());
$container->addCompilerPass(new Compiler\CheckCssEmbedFilterPass());
$container->addCompilerPass(new Compiler\CheckYuiFilterPass());
$container->addCompilerPass(new Compiler\SprocketsFilterPass());
$container->addCompilerPass(new Compiler\TemplatingPass());
$container->addCompilerPass(new Compiler\AssetFactoryPass());
$container->addCompilerPass(new Compiler\AssetManagerPass());
$container->addCompilerPass(new Compiler\FilterManagerPass());
$container->addCompilerPass(new Compiler\RouterResourcePass());
$container->addCompilerPass(new Compiler\StaticAsseticHelperPass());
}
}

View file

@ -0,0 +1,115 @@
2.8.2 / 2017-07-14
==================
* Fixed deprecation notices when using Symfony 3.3+ and PHP7+
2.8.1 / 2016-11-22
==================
* Updated the Twig integration to stop using APIs deprecated in Twig 1.27
2.8.0 / 2015-12-28
==================
### New features
* Added CleanCSS filter config
### Bug fixes
* Use the RequestStack to get the Request instead of the service
* Fixed support for Symfony 3 resources
2.7.1 / 2015-11-17
==================
* Added support for Symfony 3
2.7.0 / 2015-09-01
==================
### New features
* Added configuration for ReactJsx filter
* Upgraded the watch command to use Spork 0.3
* Added support for Twig 2
* Allow configuration of sass/scss filter sourcemap option
* Add configuration for precision in the sass/scss filter
* Treat NULL like "all bundles" in the config
### Bug fixes
* Removed usage of the deprecated Symfony APIs for Symfony 2.7+
* Fix the asset cache in the controller to take the asset dependencies into account
* Added "web" folder as a default load path for the sass filter
2.6.1 / 2015-01-27
==================
### Bug fixes
* Removed usage of the deprecated Symfony APIs for Symfony 2.6+
2.6.0 / 2015-01-26
==================
### New features
* Allow configuration of sass/scss filter cache location folders.
### Bug fixes
* Updated RequestListener to set additional format for SVG files
* Clear PHP file stat cache on each watch iteration
* Add a safeguard for template references without a bundle to be compatible with latest Symfony changes
* Fix asset dumping with assets added by the DI tag
* Change the Jsqueeze var renaming to a safer default (disabled by default)
2.5.0 / 2014-10-15
==================
### New features
* Added missing filter options for closure filters.
* Added missing filter options for uglifyjs2
* Added `relative_assets` filter option for compass filter
* Added ability to set cache_location for compass via configuration
* Added the config for the JSqueeze filter
* Added support of the boring option of the compass filter
* Added the configuration for the autoprefixer filter
* Added the config for the `no_header` option of the coffee filter
* Added missing filter options for compass
* Added the configuration for the csscachebusting filter
* Added missing options for the gss filter
* Added the configuration for the minifycsscompressor filter
* Added the configuration for the packer filter
* Added the configuration for the roole filter
* Added missing options for the scssphp filter
### Bug fixes
* Added "web" folder as a default load path for the scss filter
* Skip assets created by the assetic.asset DI tag in the routing
* Dumping leaf assets only if combine=true is not set
2.4.0 / 2014-09-04
==================
* Update to Assetic 1.2
### New features
* Added the configuration to use nib in the Stylus filter
* Added the configuration for line breaks in YUI filters
* Added `assetic:watch` to watch assets and deprecate `assetic:dump --watch`
* Added a `--forks` option to distribute dumps between processes in `assetic:dump`, using Spork
* Added the configuration for the CacheBustingWorker
* Added ability to set load paths for less, sass and scss filters through configuration
* Added defines parameter to uglifyjs & ugligyjs2 filters
* Added support for logging twig templates with an error
* Added the configuration for the emberprecompile filter
### Bug fixes
* Fixed the controller and routing to support asset variables
* Fixed the handling of the router resource type

View file

@ -0,0 +1,41 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\CacheWarmer;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
/**
* The AssetManagerCacheWarmer warms up the formula loader.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class AssetManagerCacheWarmer implements CacheWarmerInterface
{
private $container;
public function __construct(ContainerInterface $container)
{
$this->container = $container;
}
public function warmUp($cacheDir)
{
$am = $this->container->get('assetic.asset_manager');
$am->load();
}
public function isOptional()
{
return true;
}
}

View file

@ -0,0 +1,124 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Command;
use Assetic\Asset\AssetCollectionInterface;
use Assetic\Asset\AssetInterface;
use Assetic\Util\VarUtils;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
abstract class AbstractCommand extends ContainerAwareCommand
{
protected $am;
protected $basePath;
protected function initialize(InputInterface $input, OutputInterface $stdout)
{
$this->am = $this->getContainer()->get('assetic.asset_manager');
$this->basePath = $this->getContainer()->getParameter('assetic.write_to');
if ($input->hasArgument('write_to') && $basePath = $input->getArgument('write_to')) {
$this->basePath = $basePath;
}
}
/**
* Writes an asset.
*
* If the application or asset is in debug mode, each leaf asset will be
* dumped as well.
*
* @param string $name An asset name
* @param OutputInterface $stdout The command output
*/
public function dumpAsset($name, OutputInterface $stdout)
{
$asset = $this->am->get($name);
$formula = $this->am->hasFormula($name) ? $this->am->getFormula($name) : array();
// start by dumping the main asset
$this->doDump($asset, $stdout);
$debug = isset($formula[2]['debug']) ? $formula[2]['debug'] : $this->am->isDebug();
$combine = isset($formula[2]['combine']) ? $formula[2]['combine'] : !$debug;
// dump each leaf if no combine
if (!$combine) {
foreach ($asset as $leaf) {
$this->doDump($leaf, $stdout);
}
}
}
/**
* Performs the asset dump.
*
* @param AssetInterface $asset An asset
* @param OutputInterface $stdout The command output
*
* @throws RuntimeException If there is a problem writing the asset
*/
private function doDump(AssetInterface $asset, OutputInterface $stdout)
{
$combinations = VarUtils::getCombinations(
$asset->getVars(),
$this->getContainer()->getParameter('assetic.variables')
);
foreach ($combinations as $combination) {
$asset->setValues($combination);
// resolve the target path
$target = rtrim($this->basePath, '/').'/'.$asset->getTargetPath();
$target = str_replace('_controller/', '', $target);
$target = VarUtils::resolve($target, $asset->getVars(), $asset->getValues());
if (!is_dir($dir = dirname($target))) {
$stdout->writeln(sprintf(
'<comment>%s</comment> <info>[dir+]</info> %s',
date('H:i:s'),
$dir
));
if (false === @mkdir($dir, 0777, true)) {
throw new \RuntimeException('Unable to create directory '.$dir);
}
}
$stdout->writeln(sprintf(
'<comment>%s</comment> <info>[file+]</info> %s',
date('H:i:s'),
$target
));
if (OutputInterface::VERBOSITY_VERBOSE <= $stdout->getVerbosity()) {
if ($asset instanceof AssetCollectionInterface) {
foreach ($asset as $leaf) {
$root = $leaf->getSourceRoot();
$path = $leaf->getSourcePath();
$stdout->writeln(sprintf(' <comment>%s/%s</comment>', $root ?: '[unknown root]', $path ?: '[unknown path]'));
}
} else {
$root = $asset->getSourceRoot();
$path = $asset->getSourcePath();
$stdout->writeln(sprintf(' <comment>%s/%s</comment>', $root ?: '[unknown root]', $path ?: '[unknown path]'));
}
}
if (false === @file_put_contents($target, $asset->dump())) {
throw new \RuntimeException('Unable to write file '.$target);
}
}
}
}

View file

@ -0,0 +1,122 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Command;
use Spork\Batch\Strategy\ChunkStrategy;
use Spork\EventDispatcher\WrappedEventDispatcher;
use Spork\ProcessManager;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Dumps assets to the filesystem.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class DumpCommand extends AbstractCommand
{
private $spork;
protected function configure()
{
$this
->setName('assetic:dump')
->setDescription('Dumps all assets to the filesystem')
->addArgument('write_to', InputArgument::OPTIONAL, 'Override the configured asset root')
->addOption('forks', null, InputOption::VALUE_REQUIRED, 'Fork work across many processes (requires kriswallsmith/spork)')
->addOption('watch', null, InputOption::VALUE_NONE, 'DEPRECATED: use assetic:watch instead')
->addOption('force', null, InputOption::VALUE_NONE, 'DEPRECATED: use assetic:watch instead')
->addOption('period', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: use assetic:watch instead', 1)
;
}
protected function initialize(InputInterface $input, OutputInterface $stdout)
{
if (null !== $input->getOption('forks')) {
if (!class_exists('Spork\ProcessManager')) {
throw new \RuntimeException('The --forks option requires that package kriswallsmith/spork be installed');
}
if (!is_numeric($input->getOption('forks'))) {
throw new \InvalidArgumentException('The --forks options must be numeric');
}
$this->spork = new ProcessManager(
new WrappedEventDispatcher($this->getContainer()->get('event_dispatcher')),
null,
$this->getContainer()->getParameter('kernel.debug')
);
}
parent::initialize($input, $stdout);
}
protected function execute(InputInterface $input, OutputInterface $stdout)
{
// capture error output
$stderr = $stdout instanceof ConsoleOutputInterface
? $stdout->getErrorOutput()
: $stdout;
if ($input->getOption('watch')) {
$stderr->writeln(
'<error>The --watch option is deprecated. Please use the '.
'assetic:watch command instead.</error>'
);
// build assetic:watch arguments
$arguments = array(
'command' => 'assetic:watch',
'write_to' => $this->basePath,
'--period' => $input->getOption('period'),
'--env' => $input->getOption('env'),
);
if ($input->getOption('no-debug')) {
$arguments['--no-debug'] = true;
}
if ($input->getOption('force')) {
$arguments['--force'] = true;
}
$command = $this->getApplication()->find('assetic:watch');
return $command->run(new ArrayInput($arguments), $stdout);
}
// print the header
$stdout->writeln(sprintf('Dumping all <comment>%s</comment> assets.', $input->getOption('env')));
$stdout->writeln(sprintf('Debug mode is <comment>%s</comment>.', $this->am->isDebug() ? 'on' : 'off'));
$stdout->writeln('');
if ($this->spork) {
$batch = $this->spork->createBatchJob(
$this->am->getNames(),
new ChunkStrategy($input->getOption('forks'))
);
$self = $this;
$batch->execute(function ($name) use ($self, $stdout) {
$self->dumpAsset($name, $stdout);
});
} else {
foreach ($this->am->getNames() as $name) {
$this->dumpAsset($name, $stdout);
}
}
}
}

View file

@ -0,0 +1,123 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Command;
use Assetic\Util\VarUtils;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Dumps assets as their source files are modified.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class WatchCommand extends AbstractCommand
{
protected function configure()
{
$this
->setName('assetic:watch')
->setDescription('Dumps assets to the filesystem as their source files are modified')
->addArgument('write_to', InputArgument::OPTIONAL, 'Override the configured asset root')
->addOption('force', null, InputOption::VALUE_NONE, 'Force an initial generation of all assets')
->addOption('period', null, InputOption::VALUE_REQUIRED, 'Set the polling period in seconds', 1)
;
}
protected function execute(InputInterface $input, OutputInterface $stdout)
{
// capture error output
$stderr = $stdout instanceof ConsoleOutputInterface
? $stdout->getErrorOutput()
: $stdout;
// print the header
$stdout->writeln(sprintf('Dumping all <comment>%s</comment> assets.', $input->getOption('env')));
$stdout->writeln(sprintf('Debug mode is <comment>%s</comment>.', $this->am->isDebug() ? 'on' : 'off'));
$stdout->writeln('');
// establish a temporary status file
$cache = sys_get_temp_dir().'/assetic_watch_'.substr(sha1($this->basePath), 0, 7);
if ($input->getOption('force') || !file_exists($cache)) {
$previously = array();
} else {
$previously = unserialize(file_get_contents($cache));
if (!is_array($previously)) {
$previously = array();
}
}
$error = '';
while (true) {
try {
foreach ($this->am->getNames() as $name) {
if ($this->checkAsset($name, $previously)) {
$this->dumpAsset($name, $stdout);
}
}
// reset the asset manager
$this->am->clear();
$this->am->load();
file_put_contents($cache, serialize($previously));
$error = '';
} catch (\Exception $e) {
if ($error != $msg = $e->getMessage()) {
$stderr->writeln('<error>[error]</error> '.$msg);
$error = $msg;
}
}
clearstatcache ();
sleep($input->getOption('period'));
}
}
/**
* Checks if an asset should be dumped.
*
* @param string $name The asset name
* @param array &$previously An array of previous visits
*
* @return Boolean Whether the asset should be dumped
*/
private function checkAsset($name, array &$previously)
{
$formula = $this->am->hasFormula($name) ? serialize($this->am->getFormula($name)) : null;
$asset = $this->am->get($name);
$combinations = VarUtils::getCombinations(
$asset->getVars(),
$this->getContainer()->getParameter('assetic.variables')
);
$mtime = 0;
foreach ($combinations as $combination) {
$asset->setValues($combination);
$mtime = max($mtime, $this->am->getLastModified($asset));
}
if (isset($previously[$name])) {
$changed = $previously[$name]['mtime'] != $mtime || $previously[$name]['formula'] != $formula;
} else {
$changed = true;
}
$previously[$name] = array('mtime' => $mtime, 'formula' => $formula);
return $changed;
}
}

View file

@ -0,0 +1,75 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Config;
use Assetic\Factory\Resource\ResourceInterface as AsseticResourceInterface;
use Symfony\Component\Config\Resource\ResourceInterface as SymfonyResourceInterface;
/**
* Turns an Assetic resource into a Symfony one.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class AsseticResource implements SymfonyResourceInterface
{
private $resource;
public function __construct(AsseticResourceInterface $resource)
{
$this->resource = $resource;
}
public function __toString()
{
return (string) $this->resource;
}
public function isFresh($timestamp)
{
return $this->resource->isFresh($timestamp);
}
/**
* Returns the Assetic resource.
*
* @return AsseticResourceInterface The wrapped Assetic resource
*/
public function getResource()
{
return $this->resource;
}
public function exists()
{
return true;
}
public function getId()
{
return md5('assetic'.$this->resource);
}
public function getModificationTime()
{
return -1;
}
public function serialize()
{
return serialize($this->resource);
}
public function unserialize($serialized)
{
$this->resource = unserialize($serialized);
}
}

View file

@ -0,0 +1,25 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Config;
use Symfony\Component\Config\Resource\SelfCheckingResourceInterface;
/**
* Implements SelfCheckingResourceInterface required in Symfony 3.0.
*
* @author Ryan Weaver <ryan@knpuniversity.com>
*
* @internal
*/
class SelfCheckingAsseticResource extends AsseticResource implements SelfCheckingResourceInterface
{
}

View file

@ -0,0 +1,50 @@
<?php
/*
* This file is part of the Assetic package, an OpenSky project.
*
* (c) 2010-2014 OpenSky Project Inc
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\AsseticBundle\Controller;
use Assetic\Asset\AssetInterface;
use Assetic\Filter\FilterInterface;
use Assetic\Filter\HashableInterface;
/**
* This is a special filter that has a noop on its load and dump methods, but
* implements the HashableInterface, allowing it to be used with the AssetCache
* to include an additional cache key component.
*/
class AssetCacheKeyFilter implements HashableInterface, FilterInterface
{
private $cacheKey;
/**
* @param string $cacheKey A string to use as a cache key component
*/
public function __construct($cacheKey)
{
$this->cacheKey = $cacheKey;
}
/**
* {@inheritdoc}
*/
public function hash()
{
return $this->cacheKey;
}
public function filterLoad(AssetInterface $asset)
{
}
public function filterDump(AssetInterface $asset)
{
}
}

View file

@ -0,0 +1,123 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Controller;
use Assetic\Asset\AssetCache;
use Assetic\Asset\AssetInterface;
use Assetic\Cache\CacheInterface;
use Assetic\Factory\LazyAssetManager;
use Assetic\ValueSupplierInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\Profiler\Profiler;
/**
* Serves assets.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class AsseticController
{
protected $request;
protected $am;
protected $cache;
protected $enableProfiler;
protected $profiler;
public function __construct(LazyAssetManager $am, CacheInterface $cache, $enableProfiler = false, Profiler $profiler = null)
{
$this->am = $am;
$this->cache = $cache;
$this->enableProfiler = (boolean) $enableProfiler;
$this->profiler = $profiler;
}
public function setValueSupplier(ValueSupplierInterface $supplier)
{
trigger_error(sprintf('%s is deprecated. The values of asset variables are retrieved from the request after the route matching.', __METHOD__), E_USER_DEPRECATED);
}
public function render(Request $request, $name, $pos = null)
{
if (!$this->enableProfiler && null !== $this->profiler) {
$this->profiler->disable();
}
if (!$this->am->has($name)) {
throw new NotFoundHttpException(sprintf('The "%s" asset could not be found.', $name));
}
$asset = $this->am->get($name);
if (null !== $pos && !$asset = $this->findAssetLeaf($asset, $pos)) {
throw new NotFoundHttpException(sprintf('The "%s" asset does not include a leaf at position %d.', $name, $pos));
}
$response = $this->createResponse();
$response->setExpires(new \DateTime());
$this->configureAssetValues($asset, $request);
// last-modified
if (null !== $lastModified = $this->am->getLastModified($asset)) {
$date = new \DateTime();
$date->setTimestamp($lastModified);
$response->setLastModified($date);
}
// etag
if ($this->am->hasFormula($name)) {
$formula = $this->am->getFormula($name);
$formula['last_modified'] = $lastModified;
$response->setETag(md5(serialize($formula)));
}
if ($response->isNotModified($request)) {
return $response;
}
$etagCacheKeyFilter = new AssetCacheKeyFilter($response->getEtag());
$response->setContent($this->cachifyAsset($asset)->dump($etagCacheKeyFilter));
return $response;
}
protected function createResponse()
{
return new Response();
}
protected function cachifyAsset(AssetInterface $asset)
{
return new AssetCache($asset, $this->cache);
}
protected function configureAssetValues(AssetInterface $asset, Request $request)
{
if ($vars = $asset->getVars()) {
$asset->setValues(array_intersect_key($request->attributes->all(), array_flip($vars)));
}
return $this;
}
private function findAssetLeaf(\Traversable $asset, $pos)
{
$i = 0;
foreach ($asset as $leaf) {
if ($pos == $i++) {
return $leaf;
}
}
}
}

View file

@ -0,0 +1,61 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle;
use Assetic\ValueSupplierInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Default Value Supplier.
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class DefaultValueSupplier implements ValueSupplierInterface
{
protected $container;
public function __construct(ContainerInterface $container)
{
$this->container = $container;
}
public function getValues()
{
$request = $this->getCurrentRequest();
if (!$request) {
return array();
}
return array(
'locale' => $request->getLocale(),
'env' => $this->container->getParameter('kernel.environment'),
);
}
/**
* @return null|\Symfony\Component\HttpFoundation\Request
*/
private function getCurrentRequest()
{
$request = null;
$requestStack = $this->container->get('request_stack', ContainerInterface::NULL_ON_INVALID_REFERENCE);
if ($requestStack) {
$request = $requestStack->getCurrentRequest();
} elseif ($this->container->isScopeActive('request')) {
$request = $this->container->get('request');
}
return $request;
}
}

View file

@ -0,0 +1,160 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* Semantic asset configuration.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class AsseticExtension extends Extension
{
/**
* Loads the configuration.
*
* @param array $configs An array of configuration settings
* @param ContainerBuilder $container A ContainerBuilder instance
*/
public function load(array $configs, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
$loader->load('assetic.xml');
$loader->load('templating_twig.xml');
$loader->load('templating_php.xml');
$def = $container->getDefinition('assetic.parameter_bag');
if (method_exists($def, 'setFactory')) {
// to be inlined in assetic.xml when dependency on Symfony DependencyInjection is bumped to 2.6
$def->setFactory(array(new Reference('service_container'), 'getParameterBag'));
} else {
// to be removed when dependency on Symfony DependencyInjection is bumped to 2.6
$def->setFactoryService('service_container');
$def->setFactoryMethod('getParameterBag');
}
$processor = new Processor();
$configuration = $this->getConfiguration($configs, $container);
$config = $processor->processConfiguration($configuration, $configs);
$container->setParameter('assetic.debug', $config['debug']);
$container->setParameter('assetic.use_controller', $config['use_controller']['enabled']);
$container->setParameter('assetic.enable_profiler', $config['use_controller']['profiler']);
$container->setParameter('assetic.read_from', $config['read_from']);
$container->setParameter('assetic.write_to', $config['write_to']);
$container->setParameter('assetic.variables', $config['variables']);
$container->setParameter('assetic.java.bin', $config['java']);
$container->setParameter('assetic.node.bin', $config['node']);
$container->setParameter('assetic.node.paths', $config['node_paths']);
$container->setParameter('assetic.ruby.bin', $config['ruby']);
$container->setParameter('assetic.sass.bin', $config['sass']);
$container->setParameter('assetic.reactjsx.bin', $config['reactjsx']);
// register formulae
$formulae = array();
foreach ($config['assets'] as $name => $formula) {
$formulae[$name] = array($formula['inputs'], $formula['filters'], $formula['options']);
}
if ($formulae) {
$container->getDefinition('assetic.config_resource')->replaceArgument(0, $formulae);
} else {
$container->removeDefinition('assetic.config_loader');
$container->removeDefinition('assetic.config_resource');
}
// register filters
foreach ($config['filters'] as $name => $filter) {
if (isset($filter['resource'])) {
$loader->load($container->getParameterBag()->resolveValue($filter['resource']));
unset($filter['resource']);
} else {
$loader->load('filters/'.$name.'.xml');
}
if (isset($filter['file'])) {
$container->getDefinition('assetic.filter.'.$name)->setFile($filter['file']);
unset($filter['file']);
}
if (isset($filter['apply_to'])) {
if (!is_array($filter['apply_to'])) {
$filter['apply_to'] = array($filter['apply_to']);
}
foreach ($filter['apply_to'] as $i => $pattern) {
$worker = new DefinitionDecorator('assetic.worker.ensure_filter');
$worker->replaceArgument(0, '/'.$pattern.'/');
$worker->replaceArgument(1, new Reference('assetic.filter.'.$name));
$worker->addTag('assetic.factory_worker');
$container->setDefinition('assetic.filter.'.$name.'.worker'.$i, $worker);
}
unset($filter['apply_to']);
}
foreach ($filter as $key => $value) {
$container->setParameter('assetic.filter.'.$name.'.'.$key, $value);
}
}
// twig functions
$container->setParameter('assetic.twig_extension.functions', $config['twig']['functions']);
// choose dynamic or static
if ($useController = $container->getParameterBag()->resolveValue($container->getParameterBag()->get('assetic.use_controller'))) {
$loader->load('controller.xml');
$container->getDefinition('assetic.helper.dynamic')->addTag('templating.helper', array('alias' => 'assetic'));
$container->removeDefinition('assetic.helper.static');
} else {
$container->getDefinition('assetic.helper.static')->addTag('templating.helper', array('alias' => 'assetic'));
$container->removeDefinition('assetic.helper.dynamic');
}
$container->setParameter('assetic.bundles', $config['bundles']);
if ($config['workers']['cache_busting']['enabled']) {
$container->getDefinition('assetic.worker.cache_busting')->addTag('assetic.factory_worker');
}
}
/**
* Returns the base path for the XSD files.
*
* @return string The XSD base path
*/
public function getXsdValidationBasePath()
{
return __DIR__ . '/../Resources/config/schema';
}
public function getNamespace()
{
return 'http://symfony.com/schema/dic/assetic';
}
public function getConfiguration(array $config, ContainerBuilder $container)
{
$bundles = $container->getParameter('kernel.bundles');
return new Configuration(array_keys($bundles));
}
}

View file

@ -0,0 +1,36 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Adds services tagged as workers to the asset factory.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class AssetFactoryPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('assetic.asset_factory')) {
return;
}
$factory = $container->getDefinition('assetic.asset_factory');
foreach ($container->findTaggedServiceIds('assetic.factory_worker') as $id => $attr) {
$factory->addMethodCall('addWorker', array(new Reference($id)));
}
}
}

View file

@ -0,0 +1,62 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* Adds services tagged as assets to the asset manager.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class AssetManagerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('assetic.asset_manager')) {
return;
}
$am = $container->getDefinition('assetic.asset_manager');
// add assets
foreach ($container->findTaggedServiceIds('assetic.asset') as $id => $attributes) {
foreach ($attributes as $attr) {
if (isset($attr['alias'])) {
$am->addMethodCall('set', array($attr['alias'], new Reference($id)));
}
}
}
// add loaders
$loaders = array();
foreach ($container->findTaggedServiceIds('assetic.formula_loader') as $id => $attributes) {
foreach ($attributes as $attr) {
if (isset($attr['alias'])) {
$loaders[$attr['alias']] = new Reference($id);
}
}
}
$am->replaceArgument(1, $loaders);
// add resources
foreach ($container->findTaggedServiceIds('assetic.formula_resource') as $id => $attributes) {
foreach ($attributes as $attr) {
if (isset($attr['loader'])) {
$am->addMethodCall('addResource', array(new Reference($id), $attr['loader']));
}
}
}
}
}

View file

@ -0,0 +1,36 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Tags either the closure JAR or API filter for the filter manager.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class CheckClosureFilterPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if ($container->hasDefinition('assetic.filter.closure.jar')
&& $container->hasParameter('assetic.filter.closure.jar')
&& $container->getParameterBag()->resolveValue($container->getParameter('assetic.filter.closure.jar'))) {
$container->removeDefinition('assetic.filter.closure.api');
$container->setAlias('assetic.filter.closure', 'assetic.filter.closure.jar');
} elseif ($container->hasDefinition('assetic.filter.closure.api')) {
$container->removeDefinition('assetic.filter.closure.jar');
$container->setAlias('assetic.filter.closure', 'assetic.filter.closure.api');
}
}
}

View file

@ -0,0 +1,31 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Checks that the location of the CssEmbed JAR has been configured.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class CheckCssEmbedFilterPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if ($container->hasDefinition('assetic.filter.cssembed') &&
!$container->getParameterBag()->resolveValue($container->getParameter('assetic.filter.cssembed.jar'))) {
throw new \RuntimeException('The "assetic.filters.cssembed" configuration requires a "jar" value.');
}
}
}

View file

@ -0,0 +1,36 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Checks that the location of the YUI JAR has been configured.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class CheckYuiFilterPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if ($container->hasDefinition('assetic.filter.yui_css') &&
!$container->getParameterBag()->resolveValue($container->getParameter('assetic.filter.yui_css.jar'))) {
throw new \RuntimeException('The "assetic.filters.yui_css" configuration requires a "jar" value.');
}
if ($container->hasDefinition('assetic.filter.yui_js') &&
!$container->getParameterBag()->resolveValue($container->getParameter('assetic.filter.yui_js.jar'))) {
throw new \RuntimeException('The "assetic.filters.yui_js" configuration requires a "jar" value.');
}
}
}

View file

@ -0,0 +1,43 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Adds services tagged as filters to the filter manager.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class FilterManagerPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('assetic.filter_manager')) {
return;
}
$mapping = array();
foreach ($container->findTaggedServiceIds('assetic.filter') as $id => $attributes) {
foreach ($attributes as $attr) {
if (isset($attr['alias'])) {
$mapping[$attr['alias']] = $id;
}
}
}
$container
->getDefinition('assetic.filter_manager')
->replaceArgument(1, $mapping);
}
}

View file

@ -0,0 +1,59 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Yaml\Yaml;
/**
* This pass adds Assetic routes when use_controller is true.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class RouterResourcePass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$useController = $container->getParameterBag()->resolveValue($container->getParameter('assetic.use_controller'));
$routerResource = $container->getParameterBag()->resolveValue($container->getParameter('router.resource'));
if (!$useController || !$routerResource) {
return;
}
$file = $container->getParameter('kernel.cache_dir').'/assetic/routing.yml';
if (!is_dir($dir = dirname($file))) {
mkdir($dir, 0777, true);
}
$contents = array(
'_assetic' => array('resource' => '.', 'type' => 'assetic'),
'_app' => array('resource' => $container->getParameter('router.resource')),
);
$router = $container->findDefinition('router.default');
$routerConfigs = $router->getArgument(2);
if (isset($routerConfigs['resource_type'])) {
$contents['_app']['type'] = $routerConfigs['resource_type'];
}
$routerConfigs['resource_type'] = 'yaml';
$router->replaceArgument(2, $routerConfigs);
$container->setParameter('router.resource', $file);
file_put_contents($file, Yaml::dump($contents));
}
}

View file

@ -0,0 +1,35 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* Finishes configuration of the Sprockets filter.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class SprocketsFilterPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('assetic.filter.sprockets')) {
return;
}
$filter = $container->getDefinition('assetic.filter.sprockets');
foreach ($container->getParameter('assetic.filter.sprockets.include_dirs') as $dir) {
$filter->addMethodCall('addIncludeDir', array($dir));
}
}
}

View file

@ -0,0 +1,41 @@
<?php
namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;
/**
* @author Sullivan Senechal <soullivaneuh@gmail.com>
*/
class StaticAsseticHelperPass implements CompilerPassInterface
{
/**
* {@inheritdoc}
*/
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('assetic.helper.static')) {
return;
}
if ($container->hasDefinition('assets.packages')) {
return;
}
// Templating disabled in Symfony <2.6 or on 2.7+, remove the assetic helper
if (!$container->hasDefinition('templating.helper.assets') || '' === $container->getDefinition('templating.helper.assets')->getArgument(0)) {
$container->removeDefinition('assetic.helper.static');
return;
}
$definition = $container->getDefinition('assetic.helper.static');
$definition->replaceArgument(0, new Reference('templating.helper.assets'));
if (!method_exists($definition, 'setShared') && 'request' === $container->getDefinition('templating.helper.assets')->getScope()) {
$definition->setScope('request');
}
}
}

View file

@ -0,0 +1,67 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
use Symfony\Bundle\AsseticBundle\DependencyInjection\DirectoryResourceDefinition;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* This pass adds directory resources to scan for assetic assets.
*
* @author Kris Wallsmith <kris@symfony.com>
* @author Lukas Kahwe Smith <smith@pooteeweet.org>
*/
class TemplateResourcesPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('assetic.asset_manager')) {
return;
}
$engines = $container->getParameter('templating.engines');
// bundle and kernel resources
$bundles = $container->getParameter('kernel.bundles');
$asseticBundles = $container->getParameterBag()->resolveValue($container->getParameter('assetic.bundles'));
foreach ($asseticBundles as $bundleName) {
$rc = new \ReflectionClass($bundles[$bundleName]);
foreach ($engines as $engine) {
$this->setBundleDirectoryResources($container, $engine, dirname($rc->getFileName()), $bundleName);
}
}
foreach ($engines as $engine) {
$this->setAppDirectoryResources($container, $engine);
}
}
protected function setBundleDirectoryResources(ContainerBuilder $container, $engine, $bundleDirName, $bundleName)
{
$container->setDefinition(
'assetic.'.$engine.'_directory_resource.'.$bundleName,
new DirectoryResourceDefinition($bundleName, $engine, array(
$container->getParameter('kernel.root_dir').'/Resources/'.$bundleName.'/views',
$bundleDirName.'/Resources/views',
))
);
}
protected function setAppDirectoryResources(ContainerBuilder $container, $engine)
{
$container->setDefinition(
'assetic.'.$engine.'_directory_resource.kernel',
new DirectoryResourceDefinition('', $engine, array($container->getParameter('kernel.root_dir').'/Resources/views'))
);
}
}

View file

@ -0,0 +1,44 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* This pass removes services associated with unused templating engines.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class TemplatingPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('assetic.asset_manager')) {
return;
}
$engines = $container->getParameterBag()->resolveValue($container->getParameter('templating.engines'));
if (!in_array('twig', $engines)) {
foreach ($container->findTaggedServiceIds('assetic.templating.twig') as $id => $attr) {
$container->removeDefinition($id);
}
}
if (!in_array('php', $engines)) {
foreach ($container->findTaggedServiceIds('assetic.templating.php') as $id => $attr) {
$container->removeDefinition($id);
}
}
}
}

View file

@ -0,0 +1,254 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\AsseticBundle\DependencyInjection;
use Symfony\Component\Process\ExecutableFinder;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This class contains the configuration information for the bundle
*
* This information is solely responsible for how the different configuration
* sections are normalized, and merged.
*
* @author Christophe Coevoet <stof@notk.org>
* @author Kris Wallsmith <kris@symfony.com>
*/
class Configuration implements ConfigurationInterface
{
private $bundles;
/**
* Constructor
*
* @param array $bundles An array of bundle names
*/
public function __construct(array $bundles)
{
$this->bundles = $bundles;
}
/**
* Generates the configuration tree builder.
*
* @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
*/
public function getConfigTreeBuilder()
{
$builder = new TreeBuilder();
$finder = new ExecutableFinder();
$rootNode = $builder->root('assetic');
$rootNode
->children()
->booleanNode('debug')->defaultValue('%kernel.debug%')->end()
->arrayNode('use_controller')
->addDefaultsIfNotSet()
->treatTrueLike(array('enabled' => true))
->treatFalseLike(array('enabled' => false))
->children()
->booleanNode('enabled')->defaultValue('%kernel.debug%')->end()
->booleanNode('profiler')->defaultFalse()->end()
->end()
->end()
->scalarNode('read_from')->defaultValue('%kernel.root_dir%/../web')->end()
->scalarNode('write_to')->defaultValue('%assetic.read_from%')->end()
->scalarNode('java')->defaultValue(function () use ($finder) { return $finder->find('java', '/usr/bin/java'); })->end()
->scalarNode('node')->defaultValue(function () use ($finder) { return $finder->find('node', '/usr/bin/node'); })->end()
->arrayNode('node_paths')
->prototype('scalar')->end()
->end()
->scalarNode('ruby')->defaultValue(function () use ($finder) { return $finder->find('ruby', '/usr/bin/ruby'); })->end()
->scalarNode('sass')->defaultValue(function () use ($finder) { return $finder->find('sass', '/usr/bin/sass'); })->end()
->scalarNode('reactjsx')->defaultValue(function () use ($finder) { return $finder->find('reactjsx', '/usr/bin/jsx'); })->end()
->end()
;
$this->addVariablesSection($rootNode);
$this->addBundlesSection($rootNode);
$this->addAssetsSection($rootNode);
$this->addFiltersSection($rootNode, $finder);
$this->addWorkersSection($rootNode);
$this->addTwigSection($rootNode);
return $builder;
}
private function addVariablesSection(ArrayNodeDefinition $rootNode)
{
$rootNode
->fixXmlConfig('variable')
->children()
->arrayNode('variables')
->useAttributeAsKey('name')
->prototype('array')
->prototype('scalar')->end()
->end()
->end()
->end()
;
}
private function addBundlesSection(ArrayNodeDefinition $rootNode)
{
$rootNode
->fixXmlConfig('bundle')
->children()
->arrayNode('bundles')
->defaultValue($this->bundles)
->treatNullLike($this->bundles)
->prototype('scalar')
->validate()
->ifNotInArray($this->bundles)
->thenInvalid('%s is not a valid bundle.')
->end()
->end()
->end()
->end()
;
}
private function addAssetsSection(ArrayNodeDefinition $rootNode)
{
$rootNode
->fixXmlConfig('asset')
->children()
->arrayNode('assets')
->requiresAtLeastOneElement()
->useAttributeAsKey('name')
->prototype('array')
->beforeNormalization()
// a scalar is a simple formula of one input file
->ifTrue(function ($v) { return !is_array($v); })
->then(function ($v) { return array('inputs' => array($v)); })
->end()
->beforeNormalization()
->always()
->then(function ($v) {
// cast scalars as array
foreach (array('input', 'inputs', 'filter', 'filters') as $key) {
if (isset($v[$key]) && !is_array($v[$key])) {
$v[$key] = array($v[$key]);
}
}
// organize arbitrary options
foreach ($v as $key => $value) {
if (!in_array($key, array('input', 'inputs', 'filter', 'filters', 'option', 'options'))) {
$v['options'][$key] = $value;
unset($v[$key]);
}
}
return $v;
})
->end()
// the formula
->fixXmlConfig('input')
->fixXmlConfig('filter')
->children()
->arrayNode('inputs')
->prototype('scalar')->end()
->end()
->arrayNode('filters')
->prototype('scalar')->end()
->end()
->arrayNode('options')
->useAttributeAsKey('name')
->prototype('variable')->end()
->end()
->end()
->end()
->end()
->end()
;
}
private function addFiltersSection(ArrayNodeDefinition $rootNode, ExecutableFinder $finder)
{
$rootNode
->fixXmlConfig('filter')
->children()
->arrayNode('filters')
->requiresAtLeastOneElement()
->useAttributeAsKey('name')
->prototype('variable')
->treatNullLike(array())
->validate()
->ifTrue(function ($v) { return !is_array($v); })
->thenInvalid('The assetic.filters config %s must be either null or an array.')
->end()
->end()
->validate()
->always(function ($v) use ($finder) {
if (isset($v['compass']) && !isset($v['compass']['bin'])) {
$v['compass']['bin'] = $finder->find('compass', '/usr/bin/compass');
}
return $v;
})
->end()
->end()
->end()
;
}
private function addWorkersSection(ArrayNodeDefinition $rootNode)
{
$rootNode
->children()
->arrayNode('workers')
->addDefaultsIfNotSet()
->children()
->arrayNode('cache_busting')
->treatTrueLike(array('enabled' => true))
->treatFalseLike(array('enabled' => false))
->treatNullLike(array('enabled' => true))
->addDefaultsIfNotSet()
->children()
->booleanNode('enabled')->defaultFalse()->end()
->end()
->end()
->end()
->end()
->end()
;
}
private function addTwigSection(ArrayNodeDefinition $rootNode)
{
$rootNode
->children()
->arrayNode('twig')
->addDefaultsIfNotSet()
->fixXmlConfig('function')
->children()
->arrayNode('functions')
->defaultValue(array())
->useAttributeAsKey('name')
->prototype('variable')
->treatNullLike(array())
->validate()
->ifTrue(function ($v) { return !is_array($v); })
->thenInvalid('The assetic.twig.functions config %s must be either null or an array.')
->end()
->end()
->end()
->end()
->end()
->end()
;
}
}

View file

@ -0,0 +1,76 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\AsseticBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
/**
* Encapsulates logic for creating a directory resource.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class DirectoryResourceDefinition extends Definition
{
/**
* Constructor.
*
* @param string $bundle A bundle name or empty string
* @param string $engine The templating engine
* @param array $dirs An array of directories to merge
*/
public function __construct($bundle, $engine, array $dirs)
{
if (!count($dirs)) {
throw new \InvalidArgumentException('You must provide at least one directory.');
}
parent::__construct();
$this
->addTag('assetic.templating.'.$engine)
->addTag('assetic.formula_resource', array('loader' => $engine));
;
if (1 == count($dirs)) {
// no need to coalesce
self::configureDefinition($this, $bundle, $engine, reset($dirs));
return;
}
// gather the wrapped resource definitions
$resources = array();
foreach ($dirs as $dir) {
$resources[] = $resource = new Definition();
self::configureDefinition($resource, $bundle, $engine, $dir);
}
$this
->setClass('%assetic.coalescing_directory_resource.class%')
->addArgument($resources)
->setPublic(false)
;
}
private static function configureDefinition(Definition $definition, $bundle, $engine, $dir)
{
$definition
->setClass('%assetic.directory_resource.class%')
->addArgument(new Reference('templating.loader'))
->addArgument($bundle)
->addArgument($dir)
->addArgument('/\.[^.]+\.'.$engine.'$/')
->setPublic(false)
;
}
}

View file

@ -0,0 +1,32 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\EventListener;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
/**
* Adds a few formats to each request.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class RequestListener
{
public function onKernelRequest(GetResponseEvent $event)
{
$request = $event->getRequest();
$request->setFormat('png', 'image/png');
$request->setFormat('jpg', 'image/jpeg');
$request->setFormat('gif', 'image/gif');
$request->setFormat('svg', 'image/svg+xml');
}
}

View file

@ -0,0 +1,26 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Exception;
class InvalidBundleException extends \LogicException
{
public function __construct($bundle, $usage, $template, array $enabled, $code = 0, \Exception $previous = null)
{
$message = sprintf('You must add %s to the assetic.bundle config to use %s in %s.', $bundle, $usage, $template);
if ($enabled) {
$message .= sprintf(' (currently enabled: %s)', implode(', ', $enabled));
}
parent::__construct($message, $code, $previous);
}
}

View file

@ -0,0 +1,97 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Factory;
use Assetic\Factory\AssetFactory as BaseAssetFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpKernel\KernelInterface;
/**
* Loads asset formulae from the filesystem.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class AssetFactory extends BaseAssetFactory
{
private $kernel;
private $container;
private $parameterBag;
/**
* Constructor.
*
* @param KernelInterface $kernel The kernel is used to parse bundle notation
* @param ContainerInterface $container The container is used to load the managers lazily, thus avoiding a circular dependency
* @param ParameterBagInterface $parameterBag The container parameter bag
* @param string $baseDir The base directory for relative inputs
* @param Boolean $debug The current debug mode
*/
public function __construct(KernelInterface $kernel, ContainerInterface $container, ParameterBagInterface $parameterBag, $baseDir, $debug = false)
{
$this->kernel = $kernel;
$this->container = $container;
$this->parameterBag = $parameterBag;
parent::__construct($baseDir, $debug);
}
/**
* Adds support for bundle notation file and glob assets and parameter placeholders.
*
* FIXME: This is a naive implementation of globs in that it doesn't
* attempt to support bundle inheritance within the glob pattern itself.
*/
protected function parseInput($input, array $options = array())
{
$input = $this->parameterBag->resolveValue($input);
// expand bundle notation
if ('@' == $input[0] && false !== strpos($input, '/')) {
// use the bundle path as this asset's root
$bundle = substr($input, 1);
if (false !== $pos = strpos($bundle, '/')) {
$bundle = substr($bundle, 0, $pos);
}
$options['root'] = array($this->kernel->getBundle($bundle)->getPath());
// canonicalize the input
if (false !== $pos = strpos($input, '*')) {
// locateResource() does not support globs so we provide a naive implementation here
list($before, $after) = explode('*', $input, 2);
$input = $this->kernel->locateResource($before).'*'.$after;
} else {
$input = $this->kernel->locateResource($input);
}
}
return parent::parseInput($input, $options);
}
protected function createAssetReference($name)
{
if (!$this->getAssetManager()) {
$this->setAssetManager($this->container->get('assetic.asset_manager'));
}
return parent::createAssetReference($name);
}
protected function getFilter($name)
{
if (!$this->getFilterManager()) {
$this->setFilterManager($this->container->get('assetic.filter_manager'));
}
return parent::getFilter($name);
}
}

View file

@ -0,0 +1,87 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Factory\Loader;
use Assetic\Factory\Loader\BasePhpFormulaLoader;
/**
* Loads formulae from Symfony2 PHP templates.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class AsseticHelperFormulaLoader extends BasePhpFormulaLoader
{
protected function registerPrototypes()
{
return array(
'$view[\'assetic\']->javascripts(*)' => array('output' => 'js/*.js'),
'$view[\'assetic\']->stylesheets(*)' => array('output' => 'css/*.css'),
'$view[\'assetic\']->image(*)' => array('output' => 'images/*', 'single' => true),
'$view["assetic"]->javascripts(*)' => array('output' => 'js/*.js'),
'$view["assetic"]->stylesheets(*)' => array('output' => 'css/*.css'),
'$view["assetic"]->image(*)' => array('output' => 'images/*', 'single' => true),
'$view->get(\'assetic\')->javascripts(*)' => array('output' => 'js/*.js'),
'$view->get(\'assetic\')->stylesheets(*)' => array('output' => 'css/*.css'),
'$view->get(\'assetic\')->image(*)' => array('output' => 'images/*', 'single' => true),
'$view->get("assetic")->javascripts(*)' => array('output' => 'js/*.js'),
'$view->get("assetic")->stylesheets(*)' => array('output' => 'css/*.css'),
'$view->get("assetic")->image(*)' => array('output' => 'images/*', 'single' => true),
);
}
protected function registerSetupCode()
{
return <<<'EOF'
class Helper
{
public function assets()
{
global $_call;
$_call = func_get_args();
}
public function javascripts()
{
global $_call;
$_call = func_get_args();
}
public function stylesheets()
{
global $_call;
$_call = func_get_args();
}
public function image()
{
global $_call;
$_call = func_get_args();
}
}
class View extends ArrayObject
{
public function __construct(Helper $helper)
{
parent::__construct(array('assetic' => $helper));
}
public function get()
{
return $this['assetic'];
}
}
$view = new View(new Helper());
EOF;
}
}

View file

@ -0,0 +1,29 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Factory\Loader;
use Assetic\Factory\Loader\FormulaLoaderInterface;
use Assetic\Factory\Resource\ResourceInterface;
use Symfony\Bundle\AsseticBundle\Factory\Resource\ConfigurationResource;
/**
* Loads configured formulae.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class ConfigurationLoader implements FormulaLoaderInterface
{
public function load(ResourceInterface $resource)
{
return $resource instanceof ConfigurationResource ? $resource->getContent() : array();
}
}

View file

@ -0,0 +1,30 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Factory\Resource;
use Assetic\Factory\Resource\CoalescingDirectoryResource as BaseCoalescingDirectoryResource;
use Assetic\Factory\Resource\ResourceInterface;
/**
* Coalesces multiple directories together into one merged resource.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class CoalescingDirectoryResource extends BaseCoalescingDirectoryResource
{
protected function getRelativeName(ResourceInterface $file, ResourceInterface $directory)
{
$name = (string) $file;
return substr($name, strpos($name, ':'));
}
}

View file

@ -0,0 +1,44 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Factory\Resource;
use Assetic\Factory\Resource\ResourceInterface;
/**
* A configured resource.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class ConfigurationResource implements ResourceInterface
{
private $formulae;
public function __construct(array $formulae)
{
$this->formulae = $formulae;
}
public function isFresh($timestamp)
{
return true;
}
public function getContent()
{
return $this->formulae;
}
public function __toString()
{
return 'symfony';
}
}

View file

@ -0,0 +1,51 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Factory\Resource;
use Assetic\Factory\Resource\DirectoryResource as BaseDirectoryResource;
use Symfony\Component\Templating\Loader\LoaderInterface;
/**
* A directory resource that creates Symfony2 templating resources.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class DirectoryResource extends BaseDirectoryResource
{
protected $loader;
protected $bundle;
protected $path;
/**
* Constructor.
*
* @param LoaderInterface $loader The templating loader
* @param string $bundle The current bundle name
* @param string $path The directory path
* @param string $pattern A regex pattern for file basenames
*/
public function __construct(LoaderInterface $loader, $bundle, $path, $pattern = null)
{
$this->loader = $loader;
$this->bundle = $bundle;
$this->path = rtrim($path, '/').'/';
parent::__construct($path, $pattern);
}
public function getIterator()
{
return is_dir($this->path)
? new DirectoryResourceIterator($this->loader, $this->bundle, $this->path, $this->getInnerIterator())
: new \EmptyIterator();
}
}

View file

@ -0,0 +1,45 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Factory\Resource;
use Symfony\Component\Templating\Loader\LoaderInterface;
class DirectoryResourceIterator extends \RecursiveIteratorIterator
{
protected $loader;
protected $bundle;
protected $path;
/**
* Constructor.
*
* @param LoaderInterface $loader The templating loader
* @param string $bundle The current bundle name
* @param string $path The directory
* @param RecursiveIterator $iterator The inner iterator
*/
public function __construct(LoaderInterface $loader, $bundle, $path, \RecursiveIterator $iterator)
{
$this->loader = $loader;
$this->bundle = $bundle;
$this->path = $path;
parent::__construct($iterator);
}
public function current()
{
$file = parent::current();
return new FileResource($this->loader, $this->bundle, $this->path, $file->getPathname());
}
}

View file

@ -0,0 +1,88 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Factory\Resource;
use Assetic\Factory\Resource\ResourceInterface;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
use Symfony\Component\Templating\Loader\LoaderInterface;
/**
* A file resource.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class FileResource implements ResourceInterface
{
protected $loader;
protected $bundle;
protected $baseDir;
protected $path;
protected $template;
/**
* Constructor.
*
* @param LoaderInterface $loader The templating loader
* @param string $bundle The current bundle name
* @param string $baseDir The directory
* @param string $path The file path
*/
public function __construct(LoaderInterface $loader, $bundle, $baseDir, $path)
{
$this->loader = $loader;
$this->bundle = $bundle;
$this->baseDir = $baseDir;
$this->path = $path;
}
public function isFresh($timestamp)
{
return $this->loader->isFresh($this->getTemplate(), $timestamp);
}
public function getContent()
{
$templateReference = $this->getTemplate();
$fileResource = $this->loader->load($templateReference);
if (!$fileResource) {
throw new \InvalidArgumentException(sprintf('Unable to find template "%s".', $templateReference));
}
return $fileResource->getContent();
}
public function __toString()
{
return (string) $this->getTemplate();
}
protected function getTemplate()
{
if (null === $this->template) {
$this->template = self::createTemplateReference($this->bundle, substr($this->path, strlen($this->baseDir)));
}
return $this->template;
}
private static function createTemplateReference($bundle, $file)
{
$parts = explode('/', strtr($file, '\\', '/'));
$elements = explode('.', array_pop($parts));
$engine = array_pop($elements);
$format = array_pop($elements);
$name = implode('.', $elements);
return new TemplateReference($bundle, implode('/', $parts), $name, $format, $engine);
}
}

View file

@ -0,0 +1,34 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Factory\Worker;
use Assetic\Asset\AssetInterface;
use Assetic\Factory\Worker\WorkerInterface;
use Assetic\Factory\AssetFactory;
/**
* Prepends a fake front controller so the asset knows where it is-ish.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class UseControllerWorker implements WorkerInterface
{
public function process(AssetInterface $asset, AssetFactory $factory)
{
$targetUrl = $asset->getTargetPath();
if ($targetUrl && '/' != $targetUrl[0] && 0 !== strpos($targetUrl, '_controller/')) {
$asset->setTargetPath('_controller/'.$targetUrl);
}
return $asset;
}
}

View file

@ -0,0 +1,55 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle;
use Assetic\FilterManager as BaseFilterManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Lazy filter manager.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class FilterManager extends BaseFilterManager
{
protected $container;
protected $mappings;
/**
* Constructor.
*
* @param ContainerInterface $container The service container
* @param array $mappings A hash of filter names to service ids
*/
public function __construct(ContainerInterface $container, array $mappings)
{
$this->container = $container;
$this->mappings = $mappings;
}
public function get($name)
{
return isset($this->mappings[$name])
? $this->container->get($this->mappings[$name])
: parent::get($name);
}
public function has($name)
{
return isset($this->mappings[$name]) || parent::has($name);
}
public function getNames()
{
return array_unique(array_merge(array_keys($this->mappings), parent::getNames()));
}
}

19
vendor/symfony/assetic-bundle/LICENSE vendored Normal file
View file

@ -0,0 +1,19 @@
Copyright (c) 2004-2013 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

12
vendor/symfony/assetic-bundle/README.md vendored Normal file
View file

@ -0,0 +1,12 @@
AsseticBundle
=============
The `AsseticBundle` provides integration of the [Assetic](https://github.com/kriswallsmith/assetic)
library into the Symfony2 framework.
More information in the official [documentation](https://symfony.com/doc/current/cookbook/assetic/index.html).
License
=======
This bundle is released under the [MIT license](LICENSE)

View file

@ -0,0 +1,78 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.asset_factory.class">Symfony\Bundle\AsseticBundle\Factory\AssetFactory</parameter>
<parameter key="assetic.asset_manager.class">Assetic\Factory\LazyAssetManager</parameter>
<parameter key="assetic.asset_manager_cache_warmer.class">Symfony\Bundle\AsseticBundle\CacheWarmer\AssetManagerCacheWarmer</parameter>
<parameter key="assetic.cached_formula_loader.class">Assetic\Factory\Loader\CachedFormulaLoader</parameter>
<parameter key="assetic.config_cache.class">Assetic\Cache\ConfigCache</parameter>
<parameter key="assetic.config_loader.class">Symfony\Bundle\AsseticBundle\Factory\Loader\ConfigurationLoader</parameter>
<parameter key="assetic.config_resource.class">Symfony\Bundle\AsseticBundle\Factory\Resource\ConfigurationResource</parameter>
<parameter key="assetic.coalescing_directory_resource.class">Symfony\Bundle\AsseticBundle\Factory\Resource\CoalescingDirectoryResource</parameter>
<parameter key="assetic.directory_resource.class">Symfony\Bundle\AsseticBundle\Factory\Resource\DirectoryResource</parameter>
<parameter key="assetic.filter_manager.class">Symfony\Bundle\AsseticBundle\FilterManager</parameter>
<parameter key="assetic.worker.ensure_filter.class">Assetic\Factory\Worker\EnsureFilterWorker</parameter>
<parameter key="assetic.worker.cache_busting.class">Assetic\Factory\Worker\CacheBustingWorker</parameter>
<parameter key="assetic.value_supplier.class">Symfony\Bundle\AsseticBundle\DefaultValueSupplier</parameter>
<parameter key="assetic.node.paths" type="collection"></parameter>
<parameter key="assetic.cache_dir">%kernel.cache_dir%/assetic</parameter>
<parameter key="assetic.bundles" type="collection"></parameter>
</parameters>
<services>
<!-- managers -->
<service id="assetic.filter_manager" class="%assetic.filter_manager.class%">
<argument type="service" id="service_container" />
<argument type="collection"></argument>
</service>
<service id="assetic.asset_manager" class="%assetic.asset_manager.class%">
<argument type="service" id="assetic.asset_factory" />
<argument type="collection"></argument>
</service>
<service id="assetic.asset_factory" class="%assetic.asset_factory.class%" public="false">
<argument type="service" id="kernel" />
<argument type="service" id="service_container" />
<argument type="service" id="assetic.parameter_bag" />
<argument>%assetic.read_from%</argument>
<argument>%assetic.debug%</argument>
</service>
<service id="assetic.config_loader" class="%assetic.config_loader.class%" public="false">
<tag name="assetic.formula_loader" alias="config" />
</service>
<service id="assetic.config_resource" class="%assetic.config_resource.class%" public="false">
<tag name="assetic.formula_resource" loader="config" />
<argument type="collection" /> <!-- configured formulae -->
</service>
<service id="assetic.config_cache" class="%assetic.config_cache.class%" public="false">
<argument>%assetic.cache_dir%/config</argument>
</service>
<service id="assetic.asset_manager_cache_warmer" class="%assetic.asset_manager_cache_warmer.class%" public="false">
<tag name="kernel.cache_warmer" priority="10" />
<argument type="service" id="service_container" />
</service>
<service id="assetic.worker.ensure_filter" class="%assetic.worker.ensure_filter.class%" abstract="true" public="false">
<argument /> <!-- pattern -->
<argument /> <!-- filter -->
</service>
<service id="assetic.worker.cache_busting" class="%assetic.worker.cache_busting.class%" public="false" />
<service id="assetic.parameter_bag" class="Symfony\Component\DependencyInjection\ParameterBag\ParameterBag" public="false"/>
<service id="assetic.value_supplier.default" class="%assetic.value_supplier.class%" public="false">
<argument type="service" id="service_container" />
</service>
<service id="assetic.value_supplier" alias="assetic.value_supplier.default" public="false" />
</services>
</container>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.controller.class">Symfony\Bundle\AsseticBundle\Controller\AsseticController</parameter>
<parameter key="assetic.routing_loader.class">Symfony\Bundle\AsseticBundle\Routing\AsseticLoader</parameter>
<parameter key="assetic.cache.class">Assetic\Cache\FilesystemCache</parameter>
<parameter key="assetic.use_controller_worker.class">Symfony\Bundle\AsseticBundle\Factory\Worker\UseControllerWorker</parameter>
<parameter key="assetic.request_listener.class">Symfony\Bundle\AsseticBundle\EventListener\RequestListener</parameter>
</parameters>
<services>
<service id="assetic.routing_loader" class="%assetic.routing_loader.class%" public="false">
<tag name="routing.loader" />
<argument type="service" id="assetic.asset_manager" />
<argument>%assetic.variables%</argument>
</service>
<service id="assetic.controller" class="%assetic.controller.class%">
<argument type="service" id="assetic.asset_manager" />
<argument type="service" id="assetic.cache" />
<argument>%assetic.enable_profiler%</argument>
<argument type="service" id="profiler" on-invalid="null" />
</service>
<service id="assetic.cache" class="%assetic.cache.class%" public="false">
<argument>%assetic.cache_dir%/assets</argument>
</service>
<service id="assetic.use_controller_worker" class="%assetic.use_controller_worker.class%" public="false">
<tag name="assetic.factory_worker" />
</service>
<service id="assetic.request_listener" class="%assetic.request_listener.class%">
<tag name="kernel.event_listener" event="kernel.request" method="onKernelRequest" />
</service>
</services>
</container>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.autoprefixer.bin">/usr/bin/autoprefixer</parameter>
<parameter key="assetic.filter.autoprefixer.timeout">null</parameter>
<parameter key="assetic.filter.autoprefixer.node_paths">%assetic.node.paths%</parameter>
<parameter key="assetic.filter.autoprefixer.browsers" type="collection" />
</parameters>
<services>
<service id="assetic.filter.autoprefixer" class="Assetic\Filter\AutoprefixerFilter">
<tag name="assetic.filter" alias="autoprefixer" />
<argument>%assetic.filter.autoprefixer.bin%</argument>
<call method="setTimeout"><argument>%assetic.filter.autoprefixer.timeout%</argument></call>
<call method="setNodePaths"><argument>%assetic.filter.autoprefixer.node_paths%</argument></call>
<call method="setBrowsers"><argument>%assetic.filter.autoprefixer.browsers%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,61 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.cleancss.class">Assetic\Filter\CleanCssFilter</parameter>
<parameter key="assetic.filter.cleancss.bin">/usr/bin/cleancss</parameter>
<parameter key="assetic.filter.cleancss.node">%assetic.node.bin%</parameter>
<parameter key="assetic.filter.cleancss.node_paths">%assetic.node.paths%</parameter>
<parameter key="assetic.filter.cleancss.keep_line_breaks">false</parameter>
<parameter key="assetic.filter.cleancss.compatibility">false</parameter>
<parameter key="assetic.filter.cleancss.debug">false</parameter>
<parameter key="assetic.filter.cleancss.root_path">null</parameter>
<parameter key="assetic.filter.cleancss.skip_import">true</parameter>
<parameter key="assetic.filter.cleancss.timeout">null</parameter>
<parameter key="assetic.filter.cleancss.rounding_precision">null</parameter>
<parameter key="assetic.filter.cleancss.remove_special_comments">false</parameter>
<parameter key="assetic.filter.cleancss.only_keep_first_special_comment">true</parameter>
<parameter key="assetic.filter.cleancss.set_semantic_merging">false</parameter>
<parameter key="assetic.filter.cleancss.skip_advanced">true</parameter>
<parameter key="assetic.filter.cleancss.skip_aggresive_merging">true</parameter>
<parameter key="assetic.filter.cleancss.skip_import_from">null</parameter>
<parameter key="assetic.filter.cleancss.media_merging">true</parameter>
<parameter key="assetic.filter.cleancss.skip_rebase">true</parameter>
<parameter key="assetic.filter.cleancss.skip_restructuring">true</parameter>
<parameter key="assetic.filter.cleancss.skip_shorthand_compacting">true</parameter>
<parameter key="assetic.filter.cleancss.source_map">false</parameter>
<parameter key="assetic.filter.cleancss.source_map_inline_sources">false</parameter>
</parameters>
<services>
<service id="assetic.filter.cleancss" class="%assetic.filter.cleancss.class%">
<tag name="assetic.filter" alias="cleancss" />
<argument>%assetic.filter.cleancss.bin%</argument>
<argument>%assetic.filter.cleancss.node%</argument>
<call method="setNodePaths"><argument>%assetic.filter.cleancss.node_paths%</argument></call>
<call method="setKeepLineBreaks"><argument>%assetic.filter.cleancss.keep_line_breaks%</argument></call>
<call method="setRemoveSpecialComments"><argument>%assetic.filter.cleancss.remove_special_comments%</argument></call>
<call method="setOnlyKeepFirstSpecialComment"><argument>%assetic.filter.cleancss.only_keep_first_special_comment%</argument></call>
<call method="setSemanticMerging"><argument>%assetic.filter.cleancss.set_semantic_merging%</argument></call>
<call method="setRootPath"><argument>%assetic.filter.cleancss.root_path%</argument></call>
<call method="setSkipImport"><argument>%assetic.filter.cleancss.skip_import%</argument></call>
<call method="setTimeout"><argument>%assetic.filter.cleancss.timeout%</argument></call>
<call method="setSkipRebase"><argument>%assetic.filter.cleancss.skip_rebase%</argument></call>
<call method="setSkipRestructuring"><argument>%assetic.filter.cleancss.skip_restructuring%</argument></call>
<call method="setSkipShorthandCompacting"><argument>%assetic.filter.cleancss.skip_shorthand_compacting%</argument></call>
<call method="setSourceMap"><argument>%assetic.filter.cleancss.source_map%</argument></call>
<call method="setSourceMapInlineSources"><argument>%assetic.filter.cleancss.source_map_inline_sources%</argument></call>
<call method="setSkipAdvanced"><argument>%assetic.filter.cleancss.skip_advanced%</argument></call>
<call method="setSkipAggresiveMerging"><argument>%assetic.filter.cleancss.skip_aggresive_merging%</argument></call>
<call method="setSkipImportFrom"><argument>%assetic.filter.cleancss.skip_import_from%</argument></call>
<call method="setMediaMerging"><argument>%assetic.filter.cleancss.media_merging%</argument></call>
<call method="setRoundingPrecision"><argument>%assetic.filter.cleancss.rounding_precision%</argument></call>
<call method="setCompatibility"><argument>%assetic.filter.cleancss.compatibility%</argument></call>
<call method="setDebug"><argument>%assetic.filter.cleancss.debug%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,39 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.closure.api.class">Assetic\Filter\GoogleClosure\CompilerApiFilter</parameter>
<parameter key="assetic.filter.closure.jar.class">Assetic\Filter\GoogleClosure\CompilerJarFilter</parameter>
<parameter key="assetic.filter.closure.java">%assetic.java.bin%</parameter>
<parameter key="assetic.filter.closure.timeout">null</parameter>
<parameter key="assetic.filter.closure.compilation_level">null</parameter>
<parameter key="assetic.filter.closure.language_in">null</parameter>
<parameter key="assetic.filter.closure.formatting">null</parameter>
<parameter key="assetic.filter.closure.warning_level">null</parameter>
</parameters>
<services>
<service id="assetic.filter.closure.jar" class="%assetic.filter.closure.jar.class%">
<tag name="assetic.filter" alias="closure" />
<argument>%assetic.filter.closure.jar%</argument>
<argument>%assetic.filter.closure.java%</argument>
<call method="setTimeout"><argument>%assetic.filter.closure.timeout%</argument></call>
<call method="setCompilationLevel"><argument>%assetic.filter.closure.compilation_level%</argument></call>
<call method="setLanguage"><argument>%assetic.filter.closure.language_in%</argument></call>
<call method="setFormatting"><argument>%assetic.filter.closure.formatting%</argument></call>
<call method="setWarningLevel"><argument>%assetic.filter.closure.warning_level%</argument></call>
</service>
<service id="assetic.filter.closure.api" class="%assetic.filter.closure.api.class%">
<tag name="assetic.filter" alias="closure" />
<call method="setTimeout"><argument>%assetic.filter.closure.timeout%</argument></call>
<call method="setCompilationLevel"><argument>%assetic.filter.closure.compilation_level%</argument></call>
<call method="setLanguage"><argument>%assetic.filter.closure.language_in%</argument></call>
<call method="setFormatting"><argument>%assetic.filter.closure.formatting%</argument></call>
<call method="setWarningLevel"><argument>%assetic.filter.closure.warning_level%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.coffee.class">Assetic\Filter\CoffeeScriptFilter</parameter>
<parameter key="assetic.filter.coffee.bin">/usr/bin/coffee</parameter>
<parameter key="assetic.filter.coffee.node">%assetic.node.bin%</parameter>
<parameter key="assetic.filter.coffee.timeout">null</parameter>
<parameter key="assetic.filter.coffee.node_paths">%assetic.node.paths%</parameter>
<parameter key="assetic.filter.coffee.bare">null</parameter>
<parameter key="assetic.filter.coffee.no_header">null</parameter>
</parameters>
<services>
<service id="assetic.filter.coffee" class="%assetic.filter.coffee.class%">
<tag name="assetic.filter" alias="coffee" />
<argument>%assetic.filter.coffee.bin%</argument>
<argument>%assetic.filter.coffee.node%</argument>
<call method="setTimeout"><argument>%assetic.filter.coffee.timeout%</argument></call>
<call method="setNodePaths"><argument>%assetic.filter.coffee.node_paths%</argument></call>
<call method="setBare"><argument>%assetic.filter.coffee.bare%</argument></call>
<call method="setNoHeader"><argument>%assetic.filter.coffee.no_header%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,67 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.compass.class">Assetic\Filter\CompassFilter</parameter>
<parameter key="assetic.filter.compass.bin">/usr/bin/compass</parameter>
<parameter key="assetic.filter.compass.timeout">null</parameter>
<parameter key="assetic.filter.compass.debug">false</parameter>
<parameter key="assetic.filter.compass.boring">true</parameter>
<parameter key="assetic.filter.compass.no_line_comments">false</parameter>
<parameter key="assetic.filter.compass.style">null</parameter>
<parameter key="assetic.filter.compass.images_dir">null</parameter>
<parameter key="assetic.filter.compass.fonts_dir">null</parameter>
<parameter key="assetic.filter.compass.relative_assets">false</parameter>
<parameter key="assetic.filter.compass.javascripts_dir">null</parameter>
<parameter key="assetic.filter.compass.http_path">null</parameter>
<parameter key="assetic.filter.compass.http_images_path">null</parameter>
<parameter key="assetic.filter.compass.http_fonts_path">null</parameter>
<parameter key="assetic.filter.compass.http_generated_images_path">null</parameter>
<parameter key="assetic.filter.compass.generated_images_path">null</parameter>
<parameter key="assetic.filter.compass.http_javascripts_path">null</parameter>
<parameter key="assetic.filter.compass.plugins" type="collection" />
<parameter key="assetic.filter.compass.load_paths" type="collection" />
<parameter key="assetic.filter.compass.home_env">true</parameter>
<parameter key="assetic.filter.compass.scss">null</parameter>
<parameter key="assetic.filter.compass.unix_newlines">null</parameter>
<parameter key="assetic.filter.compass.no_cache">null</parameter>
<parameter key="assetic.filter.compass.force">null</parameter>
<parameter key="assetic.filter.compass.quiet">null</parameter>
<parameter key="assetic.filter.compass.cache_location">%kernel.cache_dir%</parameter>
</parameters>
<services>
<service id="assetic.filter.compass" class="%assetic.filter.compass.class%">
<tag name="assetic.filter" alias="compass" />
<argument>%assetic.filter.compass.bin%</argument>
<argument>%assetic.ruby.bin%</argument>
<call method="setScss"><argument>%assetic.filter.compass.scss%</argument></call>
<call method="setUnixNewlines"><argument>%assetic.filter.compass.unix_newlines%</argument></call>
<call method="setNoCache"><argument>%assetic.filter.compass.no_cache%</argument></call>
<call method="setForce"><argument>%assetic.filter.compass.force%</argument></call>
<call method="setQuiet"><argument>%assetic.filter.compass.quiet%</argument></call>
<call method="setTimeout"><argument>%assetic.filter.compass.timeout%</argument></call>
<call method="setDebugInfo"><argument>%assetic.filter.compass.debug%</argument></call>
<call method="setBoring"><argument>%assetic.filter.compass.boring%</argument></call>
<call method="setNoLineComments"><argument>%assetic.filter.compass.no_line_comments%</argument></call>
<call method="setStyle"><argument>%assetic.filter.compass.style%</argument></call>
<call method="setImagesDir"><argument>%assetic.filter.compass.images_dir%</argument></call>
<call method="setFontsDir"><argument>%assetic.filter.compass.fonts_dir%</argument></call>
<call method="setRelativeAssets"><argument>%assetic.filter.compass.relative_assets%</argument></call>
<call method="setJavascriptsDir"><argument>%assetic.filter.compass.javascripts_dir%</argument></call>
<call method="setHttpPath"><argument>%assetic.filter.compass.http_path%</argument></call>
<call method="setHttpImagesPath"><argument>%assetic.filter.compass.http_images_path%</argument></call>
<call method="setHttpFontsPath"><argument>%assetic.filter.compass.http_fonts_path%</argument></call>
<call method="setHttpGeneratedImagesPath"><argument>%assetic.filter.compass.http_generated_images_path%</argument></call>
<call method="setGeneratedImagesPath"><argument>%assetic.filter.compass.generated_images_path%</argument></call>
<call method="setHttpJavascriptsPath"><argument>%assetic.filter.compass.http_javascripts_path%</argument></call>
<call method="setPlugins"><argument>%assetic.filter.compass.plugins%</argument></call>
<call method="setLoadPaths"><argument>%assetic.filter.compass.load_paths%</argument></call>
<call method="setHomeEnv"><argument>%assetic.filter.compass.home_env%</argument></call>
<call method="setCacheLocation"><argument>%assetic.filter.compass.cache_location%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.csscachebusting.version">null</parameter>
<parameter key="assetic.filter.csscachebusting.format">%%s?%%s</parameter>
</parameters>
<services>
<service id="assetic.filter.csscachebusting" class="Assetic\Filter\CssCacheBustingFilter">
<tag name="assetic.filter" alias="csscachebusting" />
<call method="setVersion"><argument>%assetic.filter.csscachebusting.version%</argument></call>
<call method="setFormat"><argument>%assetic.filter.csscachebusting.format%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,36 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.cssembed.class">Assetic\Filter\CssEmbedFilter</parameter>
<parameter key="assetic.filter.cssembed.java">%assetic.java.bin%</parameter>
<parameter key="assetic.filter.cssembed.jar" />
<parameter key="assetic.filter.cssembed.timeout">null</parameter>
<parameter key="assetic.filter.cssembed.charset">%kernel.charset%</parameter>
<parameter key="assetic.filter.cssembed.mhtml">false</parameter>
<parameter key="assetic.filter.cssembed.mhtml_root">null</parameter>
<parameter key="assetic.filter.cssembed.root">null</parameter>
<parameter key="assetic.filter.cssembed.skip_missing">false</parameter>
<parameter key="assetic.filter.cssembed.max_uri_length">null</parameter>
<parameter key="assetic.filter.cssembed.max_image_size">null</parameter>
</parameters>
<services>
<service id="assetic.filter.cssembed" class="%assetic.filter.cssembed.class%">
<tag name="assetic.filter" alias="cssembed" />
<argument>%assetic.filter.cssembed.jar%</argument>
<argument>%assetic.filter.cssembed.java%</argument>
<call method="setTimeout"><argument>%assetic.filter.cssembed.timeout%</argument></call>
<call method="setCharset"><argument>%assetic.filter.cssembed.charset%</argument></call>
<call method="setMhtml"><argument>%assetic.filter.cssembed.mhtml%</argument></call>
<call method="setMhtmlRoot"><argument>%assetic.filter.cssembed.mhtml_root%</argument></call>
<call method="setRoot"><argument>%assetic.filter.cssembed.root%</argument></call>
<call method="setSkipMissing"><argument>%assetic.filter.cssembed.skip_missing%</argument></call>
<call method="setMaxUriLength"><argument>%assetic.filter.cssembed.max_uri_length%</argument></call>
<call method="setMaxImageSize"><argument>%assetic.filter.cssembed.max_image_size%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.cssimport.class">Assetic\Filter\CssImportFilter</parameter>
</parameters>
<services>
<service id="assetic.filter.cssimport" class="%assetic.filter.cssimport.class%">
<tag name="assetic.filter" alias="cssimport" />
</service>
</services>
</container>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.cssmin.class">Assetic\Filter\CssMinFilter</parameter>
<parameter key="assetic.filter.cssmin.filters" type="collection" />
<parameter key="assetic.filter.cssmin.plugins" type="collection" />
</parameters>
<services>
<service id="assetic.filter.cssmin" class="%assetic.filter.cssmin.class%">
<tag name="assetic.filter" alias="cssmin" />
<call method="setFilters"><argument>%assetic.filter.cssmin.filters%</argument></call>
<call method="setPlugins"><argument>%assetic.filter.cssmin.plugins%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.cssrewrite.class">Assetic\Filter\CssRewriteFilter</parameter>
</parameters>
<services>
<service id="assetic.filter.cssrewrite" class="%assetic.filter.cssrewrite.class%">
<tag name="assetic.filter" alias="cssrewrite" />
</service>
</services>
</container>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.dart.class">Assetic\Filter\DartFilter</parameter>
<parameter key="assetic.filter.dart.bin">/usr/bin/dart2js</parameter>
<parameter key="assetic.filter.dart.timeout">null</parameter>
</parameters>
<services>
<service id="assetic.filter.dart" class="%assetic.filter.dart.class%">
<tag name="assetic.filter" alias="dart" />
<argument>%assetic.filter.dart.bin%</argument>
<call method="setTimeout"><argument>%assetic.filter.dart.timeout%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.emberprecompile.class">Assetic\Filter\EmberPrecompileFilter</parameter>
<parameter key="assetic.filter.emberprecompile.bin">/usr/bin/ember-precompile</parameter>
<parameter key="assetic.filter.emberprecompile.node">%assetic.node.bin%</parameter>
<parameter key="assetic.filter.emberprecompile.node_paths">%assetic.node.paths%</parameter>
<parameter key="assetic.filter.emberprecompile.timeout">null</parameter>
</parameters>
<services>
<service id="assetic.filter.emberprecompile" class="%assetic.filter.emberprecompile.class%">
<tag name="assetic.filter" alias="emberprecompile" />
<argument>%assetic.filter.emberprecompile.bin%</argument>
<argument>%assetic.filter.emberprecompile.node%</argument>
<call method="setTimeout"><argument>%assetic.filter.emberprecompile.timeout%</argument></call>
<call method="setNodePaths"><argument>%assetic.filter.emberprecompile.node_paths%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,38 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.gss.class">Assetic\Filter\GssFilter</parameter>
<parameter key="assetic.filter.gss.java">%assetic.java.bin%</parameter>
<parameter key="assetic.filter.gss.jar" />
<parameter key="assetic.filter.gss.timeout">null</parameter>
<parameter key="assetic.filter.gss.allow_unrecognized_functions">null</parameter>
<parameter key="assetic.filter.gss.allowed_non_standard_functions">null</parameter>
<parameter key="assetic.filter.gss.copyright_notice">null</parameter>
<parameter key="assetic.filter.gss.define">null</parameter>
<parameter key="assetic.filter.gss.gss_function_map_provider">null</parameter>
<parameter key="assetic.filter.gss.input_orientation">null</parameter>
<parameter key="assetic.filter.gss.output_orientation">null</parameter>
<parameter key="assetic.filter.gss.pretty_print">null</parameter>
</parameters>
<services>
<service id="assetic.filter.gss" class="%assetic.filter.gss.class%">
<tag name="assetic.filter" alias="gss" />
<argument>%assetic.filter.gss.jar%</argument>
<argument>%assetic.filter.gss.java%</argument>
<call method="setTimeout"><argument>%assetic.filter.gss.timeout%</argument></call>
<call method="setAllowUnrecognizedFunctions"><argument>%assetic.filter.gss.allow_unrecognized_functions%</argument></call>
<call method="setAllowedNonStandardFunctions"><argument>%assetic.filter.gss.allowed_non_standard_functions%</argument></call>
<call method="setCopyrightNotice"><argument>%assetic.filter.gss.copyright_notice%</argument></call>
<call method="setDefine"><argument>%assetic.filter.gss.define%</argument></call>
<call method="setGssFunctionMapProvider"><argument>%assetic.filter.gss.gss_function_map_provider%</argument></call>
<call method="setInputOrientation"><argument>%assetic.filter.gss.input_orientation%</argument></call>
<call method="setOutputOrientation"><argument>%assetic.filter.gss.output_orientation%</argument></call>
<call method="setPrettyPrint"><argument>%assetic.filter.gss.pretty_print%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.handlebars.class">Assetic\Filter\HandlebarsFilter</parameter>
<parameter key="assetic.filter.handlebars.bin">/usr/bin/handlebars</parameter>
<parameter key="assetic.filter.handlebars.node">%assetic.node.bin%</parameter>
<parameter key="assetic.filter.handlebars.timeout">null</parameter>
<parameter key="assetic.filter.handlebars.node_paths">%assetic.node.paths%</parameter>
<parameter key="assetic.filter.handlebars.minimize">false</parameter>
<parameter key="assetic.filter.handlebars.simple">false</parameter>
</parameters>
<services>
<service id="assetic.filter.handlebars" class="%assetic.filter.handlebars.class%">
<tag name="assetic.filter" alias="handlebars" />
<argument>%assetic.filter.handlebars.bin%</argument>
<argument>%assetic.filter.handlebars.node%</argument>
<call method="setTimeout"><argument>%assetic.filter.handlebars.timeout%</argument></call>
<call method="setNodePaths"><argument>%assetic.filter.handlebars.node_paths%</argument></call>
<call method="setMinimize"><argument>%assetic.filter.handlebars.minimize%</argument></call>
<call method="setSimple"><argument>%assetic.filter.handlebars.simple%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.jpegoptim.class">Assetic\Filter\JpegoptimFilter</parameter>
<parameter key="assetic.filter.jpegoptim.bin">/usr/bin/jpegoptim</parameter>
<parameter key="assetic.filter.jpegoptim.timeout">null</parameter>
<parameter key="assetic.filter.jpegoptim.strip_all">false</parameter>
<parameter key="assetic.filter.jpegoptim.max">null</parameter>
</parameters>
<services>
<service id="assetic.filter.jpegoptim" class="%assetic.filter.jpegoptim.class%">
<tag name="assetic.filter" alias="jpegoptim" />
<argument>%assetic.filter.jpegoptim.bin%</argument>
<call method="setTimeout"><argument>%assetic.filter.jpegoptim.timeout%</argument></call>
<call method="setStripAll"><argument>%assetic.filter.jpegoptim.strip_all%</argument></call>
<call method="setMax"><argument>%assetic.filter.jpegoptim.max%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.jpegtran.class">Assetic\Filter\JpegtranFilter</parameter>
<parameter key="assetic.filter.jpegtran.bin">/usr/bin/jpegtran</parameter>
<parameter key="assetic.filter.jpegtran.timeout">null</parameter>
<parameter key="assetic.filter.jpegtran.copy">null</parameter>
<parameter key="assetic.filter.jpegtran.optimize">false</parameter>
<parameter key="assetic.filter.jpegtran.progressive">false</parameter>
<parameter key="assetic.filter.jpegtran.restart">null</parameter>
</parameters>
<services>
<service id="assetic.filter.jpegtran" class="%assetic.filter.jpegtran.class%">
<tag name="assetic.filter" alias="jpegtran" />
<argument>%assetic.filter.jpegtran.bin%</argument>
<call method="setTimeout"><argument>%assetic.filter.jpegtran.timeout%</argument></call>
<call method="setCopy"><argument>%assetic.filter.jpegtran.copy%</argument></call>
<call method="setOptimize"><argument>%assetic.filter.jpegtran.optimize%</argument></call>
<call method="setProgressive"><argument>%assetic.filter.jpegtran.progressive%</argument></call>
<call method="setRestart"><argument>%assetic.filter.jpegtran.restart%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.jsmin.class">Assetic\Filter\JSMinFilter</parameter>
</parameters>
<services>
<service id="assetic.filter.jsmin" class="%assetic.filter.jsmin.class%">
<tag name="assetic.filter" alias="jsmin" />
</service>
</services>
</container>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.jsminplus.class">Assetic\Filter\JSMinPlusFilter</parameter>
</parameters>
<services>
<service id="assetic.filter.jsminplus" class="%assetic.filter.jsminplus.class%">
<tag name="assetic.filter" alias="jsminplus" />
</service>
</services>
</container>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.jsqueeze.single_line">true</parameter>
<parameter key="assetic.filter.jsqueeze.keep_important_comments">true</parameter>
<parameter key="assetic.filter.jsqueeze.special_var_rx">false</parameter>
</parameters>
<services>
<service id="assetic.filter.jsqueeze" class="Assetic\Filter\JSqueezeFilter">
<tag name="assetic.filter" alias="jsqueeze" />
<call method="setSingleLine"><argument>%assetic.filter.jsqueeze.single_line%</argument></call>
<call method="keepImportantComments"><argument>%assetic.filter.jsqueeze.keep_important_comments%</argument></call>
<call method="setSpecialVarRx"><argument>%assetic.filter.jsqueeze.special_var_rx%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.less.class">Assetic\Filter\LessFilter</parameter>
<parameter key="assetic.filter.less.node">%assetic.node.bin%</parameter>
<parameter key="assetic.filter.less.node_paths">%assetic.node.paths%</parameter>
<parameter key="assetic.filter.less.timeout">null</parameter>
<parameter key="assetic.filter.less.compress">null</parameter>
<parameter key="assetic.filter.less.load_paths" type="collection" />
</parameters>
<services>
<service id="assetic.filter.less" class="%assetic.filter.less.class%">
<tag name="assetic.filter" alias="less" />
<argument>%assetic.filter.less.node%</argument>
<argument>%assetic.filter.less.node_paths%</argument>
<call method="setTimeout"><argument>%assetic.filter.less.timeout%</argument></call>
<call method="setCompress"><argument>%assetic.filter.less.compress%</argument></call>
<call method="setLoadPaths"><argument>%assetic.filter.less.load_paths%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.lessphp.class">Assetic\Filter\LessphpFilter</parameter>
<parameter key="assetic.filter.lessphp.presets" type="collection"></parameter>
<parameter key="assetic.filter.lessphp.paths" type="collection"></parameter>
<!--
"formatter" can be set to one of: "lessjs", "compressed", "classic".
See http://leafo.net/lessphp/docs/#output_formatting
-->
<parameter key="assetic.filter.lessphp.formatter">null</parameter>
<parameter key="assetic.filter.lessphp.preserve_comments">null</parameter>
</parameters>
<services>
<service id="assetic.filter.lessphp" class="%assetic.filter.lessphp.class%">
<tag name="assetic.filter" alias="lessphp" />
<call method="setPresets"><argument>%assetic.filter.lessphp.presets%</argument></call>
<call method="setLoadPaths"><argument>%assetic.filter.lessphp.paths%</argument></call>
<call method="setFormatter"><argument>%assetic.filter.lessphp.formatter%</argument></call>
<call method="setPreserveComments"><argument>%assetic.filter.lessphp.preserve_comments%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,12 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="assetic.filter.minifycsscompressor" class="Assetic\Filter\MinifyCssCompressorFilter">
<tag name="assetic.filter" alias="minifycsscompressor" />
</service>
</services>
</container>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.optipng.class">Assetic\Filter\OptiPngFilter</parameter>
<parameter key="assetic.filter.optipng.bin">/usr/bin/optipng</parameter>
<parameter key="assetic.filter.optipng.timeout">null</parameter>
<parameter key="assetic.filter.optipng.level">null</parameter>
</parameters>
<services>
<service id="assetic.filter.optipng" class="%assetic.filter.optipng.class%">
<tag name="assetic.filter" alias="optipng" />
<argument>%assetic.filter.optipng.bin%</argument>
<call method="setTimeout"><argument>%assetic.filter.optipng.timeout%</argument></call>
<call method="setLevel"><argument>%assetic.filter.optipng.level%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,18 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.packager.class">Assetic\Filter\PackagerFilter</parameter>
<parameter key="assetic.filter.packager.packages" type="collection" />
</parameters>
<services>
<service id="assetic.filter.packager" class="%assetic.filter.packager.class%">
<tag name="assetic.filter" alias="packager" />
<argument>%assetic.filter.packager.packages%</argument>
</service>
</services>
</container>

View file

@ -0,0 +1,21 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.packer.special_chars">false</parameter>
<parameter key="assetic.filter.packer.fast_decode">true</parameter>
<parameter key="assetic.filter.packer.encoding">None</parameter>
</parameters>
<services>
<service id="assetic.filter.packer" class="Assetic\Filter\PackerFilter">
<tag name="assetic.filter" alias="packer" />
<call method="setFastDecode"><argument>%assetic.filter.packer.fast_decode%</argument></call>
<call method="setSpecialChars"><argument>%assetic.filter.packer.special_chars%</argument></call>
<call method="setEncoding"><argument>%assetic.filter.packer.encoding%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.phpcssembed.class">Assetic\Filter\PhpCssEmbedFilter</parameter>
</parameters>
<services>
<service id="assetic.filter.phpcssembed" class="%assetic.filter.phpcssembed.class%">
<tag name="assetic.filter" alias="phpcssembed" />
</service>
</services>
</container>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.pngout.class">Assetic\Filter\PngoutFilter</parameter>
<parameter key="assetic.filter.pngout.bin">/usr/bin/pngout</parameter>
<parameter key="assetic.filter.pngout.timeout">null</parameter>
<parameter key="assetic.filter.pngout.color">null</parameter>
<parameter key="assetic.filter.pngout.filter">null</parameter>
<parameter key="assetic.filter.pngout.strategy">null</parameter>
<parameter key="assetic.filter.pngout.block_split_threshold">null</parameter>
</parameters>
<services>
<service id="assetic.filter.pngout" class="%assetic.filter.pngout.class%">
<tag name="assetic.filter" alias="pngout" />
<argument>%assetic.filter.pngout.bin%</argument>
<call method="setTimeout"><argument>%assetic.filter.pngout.timeout%</argument></call>
<call method="setColor"><argument>%assetic.filter.pngout.color%</argument></call>
<call method="setFilter"><argument>%assetic.filter.pngout.filter%</argument></call>
<call method="setStrategy"><argument>%assetic.filter.pngout.strategy%</argument></call>
<call method="setBlockSplitThreshold"><argument>%assetic.filter.pngout.block_split_threshold%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.reactjsx.class">Assetic\Filter\ReactJsxFilter</parameter>
<parameter key="assetic.filter.reactjsx.bin">%assetic.reactjsx.bin%</parameter>
</parameters>
<services>
<service id="assetic.filter.reactjsx" class="%assetic.filter.reactjsx.class%">
<tag name="assetic.filter" alias="reactjsx" />
<argument>%assetic.filter.reactjsx.bin%</argument>
<argument>%assetic.node.bin%</argument>
</service>
</services>
</container>

View file

@ -0,0 +1,23 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.roole.bin">/usr/bin/roole</parameter>
<parameter key="assetic.filter.roole.node">%assetic.node.bin%</parameter>
<parameter key="assetic.filter.roole.timeout">null</parameter>
<parameter key="assetic.filter.roole.node_paths">%assetic.node.paths%</parameter>
</parameters>
<services>
<service id="assetic.filter.roole" class="Assetic\Filter\RooleFilter">
<tag name="assetic.filter" alias="coffee" />
<argument>%assetic.filter.roole.bin%</argument>
<argument>%assetic.filter.roole.node%</argument>
<call method="setTimeout"><argument>%assetic.filter.roole.timeout%</argument></call>
<call method="setNodePaths"><argument>%assetic.filter.roole.node_paths%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.sass.class">Assetic\Filter\Sass\SassFilter</parameter>
<parameter key="assetic.filter.sass.bin">%assetic.sass.bin%</parameter>
<parameter key="assetic.filter.sass.timeout">null</parameter>
<parameter key="assetic.filter.sass.style">null</parameter>
<parameter key="assetic.filter.sass.compass">null</parameter>
<parameter key="assetic.filter.sass.precision">null</parameter>
<parameter key="assetic.filter.sass.load_paths" type="collection">
<parameter>%kernel.root_dir%/../web</parameter>
</parameter>
<parameter key="assetic.filter.sass.cache_location">%kernel.cache_dir%</parameter>
<parameter key="assetic.filter.sass.enable_sourcemaps">null</parameter>
</parameters>
<services>
<service id="assetic.filter.sass" class="%assetic.filter.sass.class%">
<tag name="assetic.filter" alias="sass" />
<argument>%assetic.filter.sass.bin%</argument>
<argument>%assetic.ruby.bin%</argument>
<call method="setTimeout"><argument>%assetic.filter.sass.timeout%</argument></call>
<call method="setStyle"><argument>%assetic.filter.sass.style%</argument></call>
<call method="setCompass"><argument>%assetic.filter.sass.compass%</argument></call>
<call method="setLoadPaths"><argument>%assetic.filter.sass.load_paths%</argument></call>
<call method="setCacheLocation"><argument>%assetic.filter.sass.cache_location%</argument></call>
<call method="setSourceMap"><argument>%assetic.filter.sass.enable_sourcemaps%</argument></call>
<call method="setPrecision"><argument>%assetic.filter.sass.precision%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.scss.class">Assetic\Filter\Sass\ScssFilter</parameter>
<parameter key="assetic.filter.scss.sass">%assetic.sass.bin%</parameter>
<parameter key="assetic.filter.scss.timeout">null</parameter>
<parameter key="assetic.filter.scss.style">null</parameter>
<parameter key="assetic.filter.scss.compass">null</parameter>
<parameter key="assetic.filter.scss.precision">null</parameter>
<parameter key="assetic.filter.scss.load_paths" type="collection">
<parameter>%kernel.root_dir%/../web</parameter>
</parameter>
<parameter key="assetic.filter.scss.cache_location">%kernel.cache_dir%</parameter>
<parameter key="assetic.filter.scss.enable_sourcemaps">null</parameter>
</parameters>
<services>
<service id="assetic.filter.scss" class="%assetic.filter.scss.class%">
<tag name="assetic.filter" alias="scss" />
<argument>%assetic.filter.scss.sass%</argument>
<argument>%assetic.ruby.bin%</argument>
<call method="setTimeout"><argument>%assetic.filter.scss.timeout%</argument></call>
<call method="setStyle"><argument>%assetic.filter.scss.style%</argument></call>
<call method="setCompass"><argument>%assetic.filter.scss.compass%</argument></call>
<call method="setLoadPaths"><argument>%assetic.filter.scss.load_paths%</argument></call>
<call method="setCacheLocation"><argument>%assetic.filter.scss.cache_location%</argument></call>
<call method="setSourceMap"><argument>%assetic.filter.scss.enable_sourcemaps%</argument></call>
<call method="setPrecision"><argument>%assetic.filter.scss.precision%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.scssphp.class">Assetic\Filter\ScssphpFilter</parameter>
<parameter key="assetic.filter.scssphp.import_paths" type="collection" />
<parameter key="assetic.filter.scssphp.compass">false</parameter>
<parameter key="assetic.filter.scssphp.variables" type="collection" />
<parameter key="assetic.filter.scssphp.formatter">null</parameter>
</parameters>
<services>
<service id="assetic.filter.scssphp" class="%assetic.filter.scssphp.class%">
<call method="enableCompass">
<argument>%assetic.filter.scssphp.compass%</argument>
</call>
<call method="setImportPaths">
<argument>%assetic.filter.scssphp.import_paths%</argument>
</call>
<call method="setVariables"><argument>%assetic.filter.scssphp.variables%</argument></call>
<call method="setFormatter"><argument>%assetic.filter.scssphp.formatter%</argument></call>
<tag name="assetic.filter" alias="scssphp" />
</service>
</services>
</container>

View file

@ -0,0 +1,25 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.sprockets.class">Assetic\Filter\SprocketsFilter</parameter>
<parameter key="assetic.filter.sprockets.lib">null</parameter>
<parameter key="assetic.filter.sprockets.ruby">%assetic.ruby.bin%</parameter>
<parameter key="assetic.filter.sprockets.timeout">null</parameter>
<parameter key="assetic.filter.sprockets.asset_root">%assetic.write_to%</parameter>
<parameter key="assetic.filter.sprockets.include_dirs" type="collection" />
</parameters>
<services>
<service id="assetic.filter.sprockets" class="%assetic.filter.sprockets.class%">
<tag name="assetic.filter" alias="sprockets" />
<argument>%assetic.filter.sprockets.lib%</argument>
<argument>%assetic.filter.sprockets.ruby%</argument>
<call method="setTimeout"><argument>%assetic.filter.sprockets.timeout%</argument></call>
<call method="setAssetRoot"><argument>%assetic.filter.sprockets.asset_root%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,26 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.stylus.class">Assetic\Filter\StylusFilter</parameter>
<parameter key="assetic.filter.stylus.node">%assetic.node.bin%</parameter>
<parameter key="assetic.filter.stylus.node_paths">%assetic.node.paths%</parameter>
<parameter key="assetic.filter.stylus.timeout">null</parameter>
<parameter key="assetic.filter.stylus.compress">null</parameter>
<parameter key="assetic.filter.stylus.nib">null</parameter>
</parameters>
<services>
<service id="assetic.filter.stylus" class="%assetic.filter.stylus.class%">
<tag name="assetic.filter" alias="stylus" />
<argument>%assetic.filter.stylus.node%</argument>
<argument>%assetic.filter.stylus.node_paths%</argument>
<call method="setTimeout"><argument>%assetic.filter.stylus.timeout%</argument></call>
<call method="setCompress"><argument>%assetic.filter.stylus.compress%</argument></call>
<call method="setUseNib"><argument>%assetic.filter.stylus.nib%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.typescript.class">Assetic\Filter\TypeScriptFilter</parameter>
<parameter key="assetic.filter.typescript.bin">/usr/bin/tsc</parameter>
<parameter key="assetic.filter.typescript.node">%assetic.node.bin%</parameter>
<parameter key="assetic.filter.typescript.node_paths">%assetic.node.paths%</parameter>
<parameter key="assetic.filter.typescript.timeout">null</parameter>
</parameters>
<services>
<service id="assetic.filter.typescript" class="%assetic.filter.typescript.class%">
<tag name="assetic.filter" alias="typescript" />
<argument>%assetic.filter.typescript.bin%</argument>
<argument>%assetic.filter.typescript.node%</argument>
<call method="setTimeout"><argument>%assetic.filter.typescript.timeout%</argument></call>
<call method="setNodePaths"><argument>%assetic.filter.typescript.node_paths%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,30 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.uglifycss.class">Assetic\Filter\UglifyCssFilter</parameter>
<parameter key="assetic.filter.uglifycss.bin">/usr/bin/uglifycss</parameter>
<parameter key="assetic.filter.uglifycss.node">%assetic.node.bin%</parameter>
<parameter key="assetic.filter.uglifycss.timeout">null</parameter>
<parameter key="assetic.filter.uglifycss.node_paths">%assetic.node.paths%</parameter>
<parameter key="assetic.filter.uglifycss.expand_vars">false</parameter>
<parameter key="assetic.filter.uglifycss.ugly_comments">false</parameter>
<parameter key="assetic.filter.uglifycss.cute_comments">false</parameter>
</parameters>
<services>
<service id="assetic.filter.uglifycss" class="%assetic.filter.uglifycss.class%">
<tag name="assetic.filter" alias="uglifycss" />
<argument>%assetic.filter.uglifycss.bin%</argument>
<argument>%assetic.filter.uglifycss.node%</argument>
<call method="setTimeout"><argument>%assetic.filter.uglifycss.timeout%</argument></call>
<call method="setNodePaths"><argument>%assetic.filter.uglifycss.node_paths%</argument></call>
<call method="setExpandVars"><argument>%assetic.filter.uglifycss.expand_vars%</argument></call>
<call method="setUglyComments"><argument>%assetic.filter.uglifycss.ugly_comments%</argument></call>
<call method="setCuteComments"><argument>%assetic.filter.uglifycss.cute_comments%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.uglifyjs.class">Assetic\Filter\UglifyJsFilter</parameter>
<parameter key="assetic.filter.uglifyjs.bin">/usr/bin/uglifyjs</parameter>
<parameter key="assetic.filter.uglifyjs.node">%assetic.node.bin%</parameter>
<parameter key="assetic.filter.uglifyjs.timeout">null</parameter>
<parameter key="assetic.filter.uglifyjs.node_paths">%assetic.node.paths%</parameter>
<parameter key="assetic.filter.uglifyjs.beautify">false</parameter>
<parameter key="assetic.filter.uglifyjs.no_copyright">false</parameter>
<parameter key="assetic.filter.uglifyjs.unsafe">false</parameter>
<parameter key="assetic.filter.uglifyjs.mangle">false</parameter>
<parameter key="assetic.filter.uglifyjs.defines" type="collection"></parameter>
</parameters>
<services>
<service id="assetic.filter.uglifyjs" class="%assetic.filter.uglifyjs.class%">
<tag name="assetic.filter" alias="uglifyjs" />
<argument>%assetic.filter.uglifyjs.bin%</argument>
<argument>%assetic.filter.uglifyjs.node%</argument>
<call method="setTimeout"><argument>%assetic.filter.uglifyjs.timeout%</argument></call>
<call method="setNodePaths"><argument>%assetic.filter.uglifyjs.node_paths%</argument></call>
<call method="setBeautify"><argument>%assetic.filter.uglifyjs.beautify%</argument></call>
<call method="setNoCopyright"><argument>%assetic.filter.uglifyjs.no_copyright%</argument></call>
<call method="setUnsafe"><argument>%assetic.filter.uglifyjs.unsafe%</argument></call>
<call method="setMangle"><argument>%assetic.filter.uglifyjs.mangle%</argument></call>
<call method="setDefines"><argument>%assetic.filter.uglifyjs.defines%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,38 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.uglifyjs2.class">Assetic\Filter\UglifyJs2Filter</parameter>
<parameter key="assetic.filter.uglifyjs2.bin">/usr/bin/uglifyjs</parameter>
<parameter key="assetic.filter.uglifyjs2.node">%assetic.node.bin%</parameter>
<parameter key="assetic.filter.uglifyjs2.timeout">null</parameter>
<parameter key="assetic.filter.uglifyjs2.node_paths">%assetic.node.paths%</parameter>
<parameter key="assetic.filter.uglifyjs2.compress">false</parameter>
<parameter key="assetic.filter.uglifyjs2.beautify">false</parameter>
<parameter key="assetic.filter.uglifyjs2.mangle">false</parameter>
<parameter key="assetic.filter.uglifyjs2.screw_ie8">false</parameter>
<parameter key="assetic.filter.uglifyjs2.comments">false</parameter>
<parameter key="assetic.filter.uglifyjs2.wrap">false</parameter>
<parameter key="assetic.filter.uglifyjs2.defines" type="collection"></parameter>
</parameters>
<services>
<service id="assetic.filter.uglifyjs2" class="%assetic.filter.uglifyjs2.class%">
<tag name="assetic.filter" alias="uglifyjs2" />
<argument>%assetic.filter.uglifyjs2.bin%</argument>
<argument>%assetic.filter.uglifyjs2.node%</argument>
<call method="setTimeout"><argument>%assetic.filter.uglifyjs2.timeout%</argument></call>
<call method="setNodePaths"><argument>%assetic.filter.uglifyjs2.node_paths%</argument></call>
<call method="setCompress"><argument>%assetic.filter.uglifyjs2.compress%</argument></call>
<call method="setBeautify"><argument>%assetic.filter.uglifyjs2.beautify%</argument></call>
<call method="setMangle"><argument>%assetic.filter.uglifyjs2.mangle%</argument></call>
<call method="setScrewIe8"><argument>%assetic.filter.uglifyjs2.screw_ie8%</argument></call>
<call method="setComments"><argument>%assetic.filter.uglifyjs2.comments%</argument></call>
<call method="setWrap"><argument>%assetic.filter.uglifyjs2.wrap%</argument></call>
<call method="setDefines"><argument>%assetic.filter.uglifyjs2.defines%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,28 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.yui_css.class">Assetic\Filter\Yui\CssCompressorFilter</parameter>
<parameter key="assetic.filter.yui_css.java">%assetic.java.bin%</parameter>
<parameter key="assetic.filter.yui_css.jar" />
<parameter key="assetic.filter.yui_css.charset">%kernel.charset%</parameter>
<parameter key="assetic.filter.yui_css.stacksize">null</parameter>
<parameter key="assetic.filter.yui_css.timeout">null</parameter>
<parameter key="assetic.filter.yui_css.linebreak">null</parameter>
</parameters>
<services>
<service id="assetic.filter.yui_css" class="%assetic.filter.yui_css.class%">
<tag name="assetic.filter" alias="yui_css" />
<argument>%assetic.filter.yui_css.jar%</argument>
<argument>%assetic.filter.yui_css.java%</argument>
<call method="setCharset"><argument>%assetic.filter.yui_css.charset%</argument></call>
<call method="setTimeout"><argument>%assetic.filter.yui_css.timeout%</argument></call>
<call method="setStackSize"><argument>%assetic.filter.yui_css.stacksize%</argument></call>
<call method="setLineBreak"><argument>%assetic.filter.yui_css.linebreak%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,34 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.filter.yui_js.class">Assetic\Filter\Yui\JsCompressorFilter</parameter>
<parameter key="assetic.filter.yui_js.java">%assetic.java.bin%</parameter>
<parameter key="assetic.filter.yui_js.jar" />
<parameter key="assetic.filter.yui_js.charset">%kernel.charset%</parameter>
<parameter key="assetic.filter.yui_js.stacksize">null</parameter>
<parameter key="assetic.filter.yui_js.timeout">null</parameter>
<parameter key="assetic.filter.yui_js.nomunge">null</parameter>
<parameter key="assetic.filter.yui_js.preserve_semi">null</parameter>
<parameter key="assetic.filter.yui_js.disable_optimizations">null</parameter>
<parameter key="assetic.filter.yui_js.linebreak">null</parameter>
</parameters>
<services>
<service id="assetic.filter.yui_js" class="%assetic.filter.yui_js.class%">
<tag name="assetic.filter" alias="yui_js" />
<argument>%assetic.filter.yui_js.jar%</argument>
<argument>%assetic.filter.yui_js.java%</argument>
<call method="setCharset"><argument>%assetic.filter.yui_js.charset%</argument></call>
<call method="setTimeout"><argument>%assetic.filter.yui_js.timeout%</argument></call>
<call method="setStackSize"><argument>%assetic.filter.yui_js.stacksize%</argument></call>
<call method="setNomunge"><argument>%assetic.filter.yui_js.nomunge%</argument></call>
<call method="setPreserveSemi"><argument>%assetic.filter.yui_js.preserve_semi%</argument></call>
<call method="setDisableOptimizations"><argument>%assetic.filter.yui_js.disable_optimizations%</argument></call>
<call method="setLineBreak"><argument>%assetic.filter.yui_js.linebreak%</argument></call>
</service>
</services>
</container>

View file

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns="http://symfony.com/schema/dic/assetic"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://symfony.com/schema/dic/assetic"
elementFormDefault="qualified">
<xsd:element name="config" type="config" />
<xsd:complexType name="config">
<xsd:sequence>
<xsd:element name="bundle" type="bundle" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="filter" type="filter" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="workers" type="workers" minOccurs="0" maxOccurs="1" />
<xsd:element name="twig" type="twig" minOccurs="0" maxOccurs="unbounded" />
<xsd:element name="asset" type="asset" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="debug" type="xsd:string" />
<xsd:attribute name="use-controller" type="xsd:string" />
<xsd:attribute name="read-from" type="xsd:string" />
<xsd:attribute name="write-to" type="xsd:string" />
<xsd:attribute name="dump-on-warmup" type="xsd:string" />
<xsd:attribute name="java" type="xsd:string" />
<xsd:attribute name="node" type="xsd:string" />
<xsd:attribute name="sass" type="xsd:string" />
<xsd:attribute name="reactjsx" type="xsd:string" />
</xsd:complexType>
<xsd:complexType name="bundle">
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
<xsd:complexType name="asset">
<xsd:sequence>
<xsd:element name="input" type="xsd:string" minOccurs="1" maxOccurs="unbounded" />
<xsd:element name="filter" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
<xsd:attribute name="output" type="xsd:string" />
<xsd:attribute name="debug" type="xsd:string" />
<xsd:anyAttribute namespace="##any" processContents="lax" />
</xsd:complexType>
<xsd:complexType name="filter">
<xsd:attribute name="name" type="xsd:string" use="required" />
<xsd:attribute name="resource" type="xsd:string" />
<xsd:anyAttribute namespace="##any" processContents="lax" />
</xsd:complexType>
<xsd:complexType name="workers">
<xsd:all>
<xsd:element name="cache-busting" type="worker_cache_busting" minOccurs="0" maxOccurs="1" />
</xsd:all>
</xsd:complexType>
<xsd:complexType name="worker_cache_busting">
<xsd:attribute name="enabled" type="xsd:boolean" />
</xsd:complexType>
<xsd:complexType name="twig">
<xsd:sequence>
<xsd:element name="function" type="twig_function" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="twig_function">
<xsd:attribute name="name" type="xsd:string" use="required" />
<xsd:anyAttribute namespace="##any" processContents="lax" />
</xsd:complexType>
</xsd:schema>

View file

@ -0,0 +1,39 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.helper.dynamic.class">Symfony\Bundle\AsseticBundle\Templating\DynamicAsseticHelper</parameter>
<parameter key="assetic.helper.static.class">Symfony\Bundle\AsseticBundle\Templating\StaticAsseticHelper</parameter>
<parameter key="assetic.php_formula_loader.class">Symfony\Bundle\AsseticBundle\Factory\Loader\AsseticHelperFormulaLoader</parameter>
</parameters>
<services>
<service id="assetic.helper.dynamic" class="%assetic.helper.dynamic.class%">
<tag name="assetic.templating.php" />
<argument type="service" id="templating.helper.router" />
<argument type="service" id="assetic.asset_factory" />
</service>
<service id="assetic.helper.static" class="%assetic.helper.static.class%">
<tag name="assetic.templating.php" />
<argument type="service" id="assets.packages" />
<argument type="service" id="assetic.asset_factory" />
</service>
<service id="assetic.php_formula_loader" class="%assetic.cached_formula_loader.class%" public="false">
<tag name="assetic.formula_loader" alias="php" />
<tag name="assetic.templating.php" />
<argument type="service" id="assetic.php_formula_loader.real" />
<argument type="service" id="assetic.config_cache" />
<argument>%kernel.debug%</argument>
</service>
<service id="assetic.php_formula_loader.real" class="%assetic.php_formula_loader.class%" public="false">
<tag name="assetic.templating.php" />
<argument type="service" id="assetic.asset_factory" />
</service>
</services>
</container>

View file

@ -0,0 +1,37 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="assetic.twig_extension.class">Symfony\Bundle\AsseticBundle\Twig\AsseticExtension</parameter>
<parameter key="assetic.twig_formula_loader.class">Assetic\Extension\Twig\TwigFormulaLoader</parameter>
</parameters>
<services>
<service id="assetic.twig_extension" class="%assetic.twig_extension.class%" public="false">
<tag name="twig.extension" />
<tag name="assetic.templating.twig" />
<argument type="service" id="assetic.asset_factory" />
<argument type="service" id="templating.name_parser" />
<argument>%assetic.use_controller%</argument>
<argument>%assetic.twig_extension.functions%</argument>
<argument>%assetic.bundles%</argument>
<argument type="service" id="assetic.value_supplier" on-invalid="null" />
</service>
<service id="assetic.twig_formula_loader" class="%assetic.cached_formula_loader.class%" public="false">
<tag name="assetic.formula_loader" alias="twig" />
<tag name="assetic.templating.twig" />
<argument type="service" id="assetic.twig_formula_loader.real" />
<argument type="service" id="assetic.config_cache" />
<argument>%kernel.debug%</argument>
</service>
<service id="assetic.twig_formula_loader.real" class="%assetic.twig_formula_loader.class%" public="false">
<tag name="assetic.templating.twig" />
<tag name="monolog.logger" channel="assetic" />
<argument type="service" id="twig" />
<argument type="service" id="logger" on-invalid="ignore" />
</service>
</services>
</container>

View file

@ -0,0 +1,148 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Routing;
use Assetic\Asset\AssetInterface;
use Assetic\Factory\LazyAssetManager;
use Symfony\Bundle\AsseticBundle\Config\AsseticResource;
use Symfony\Bundle\AsseticBundle\Config\SelfCheckingAsseticResource;
use Symfony\Component\Config\Loader\Loader;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
/**
* Loads routes for all assets.
*
* Assets should only be served through the routing system for ease-of-use
* during development.
*
* For example, add the following to your application's routing_dev.yml:
*
* _assetic:
* resource: .
* type: assetic
*
* In a production environment you should use the `assetic:dump` command to
* create static asset files.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class AsseticLoader extends Loader
{
protected $am;
private $varValues;
public function __construct(LazyAssetManager $am, array $varValues = array())
{
$this->am = $am;
$this->varValues = $varValues;
}
public function load($routingResource, $type = null)
{
$routes = new RouteCollection();
// resources
foreach ($this->am->getResources() as $resources) {
if (!$resources instanceof \Traversable) {
$resources = array($resources);
}
foreach ($resources as $resource) {
if (interface_exists('Symfony\Component\Config\Resource\SelfCheckingResourceInterface')) {
$routes->addResource(new SelfCheckingAsseticResource($resource));
} else {
// for BC with symfony/config 2.7 and lower
$routes->addResource(new AsseticResource($resource));
}
}
}
// routes
foreach ($this->am->getNames() as $name) {
if (!$this->am->hasFormula($name)) {
continue;
}
$asset = $this->am->get($name);
$formula = $this->am->getFormula($name);
$this->loadRouteForAsset($routes, $asset, $name);
$debug = isset($formula[2]['debug']) ? $formula[2]['debug'] : $this->am->isDebug();
$combine = isset($formula[2]['combine']) ? $formula[2]['combine'] : !$debug;
// add a route for each "leaf" in debug mode
if (!$combine) {
$i = 0;
foreach ($asset as $leaf) {
$this->loadRouteForAsset($routes, $leaf, $name, $i++);
}
}
}
return $routes;
}
/**
* Loads a route to serve an supplied asset.
*
* The fake front controller that {@link UseControllerWorker} adds to the
* target URL will be removed before set as a route pattern.
*
* @param RouteCollection $routes The route collection
* @param AssetInterface $asset The asset
* @param string $name The name to use
* @param integer $pos The leaf index
*/
private function loadRouteForAsset(RouteCollection $routes, AssetInterface $asset, $name, $pos = null)
{
$defaults = array(
'_controller' => 'assetic.controller:render',
'name' => $name,
'pos' => $pos,
);
$requirements = array();
// remove the fake front controller
$pattern = str_replace('_controller/', '', $asset->getTargetPath());
if ($format = pathinfo($pattern, PATHINFO_EXTENSION)) {
$defaults['_format'] = $format;
}
$route = '_assetic_'.$name;
if (null !== $pos) {
$route .= '_'.$pos;
}
foreach ($asset->getVars() as $var) {
if (empty($this->varValues[$var])) {
throw new \UnexpectedValueException(sprintf('The possible values for the asset variable "%s" are not known', $var));
}
$values = array();
foreach ($this->varValues[$var] as $value) {
$values[] = preg_quote($value, '#');
}
$requirements[$var] = implode('|', $values);
}
$routes->add($route, new Route($pattern, $defaults, $requirements));
}
public function supports($resource, $type = null)
{
return 'assetic' == $type;
}
}

View file

@ -0,0 +1,156 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Templating;
use Assetic\Asset\AssetInterface;
use Assetic\Factory\AssetFactory;
use Assetic\Util\TraversableString;
use Symfony\Component\Templating\Helper\Helper;
/**
* The "assetic" templating helper.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
abstract class AsseticHelper extends Helper
{
protected $factory;
/**
* Constructor.
*
* @param AssetFactory $factory The asset factory
*/
public function __construct(AssetFactory $factory)
{
$this->factory = $factory;
}
/**
* Returns an array of javascript urls.
*/
public function javascripts($inputs = array(), $filters = array(), array $options = array())
{
if (!isset($options['output'])) {
$options['output'] = 'js/*.js';
}
return $this->getAssetUrls($inputs, $filters, $options);
}
/**
* Returns an array of stylesheet urls.
*/
public function stylesheets($inputs = array(), $filters = array(), array $options = array())
{
if (!isset($options['output'])) {
$options['output'] = 'css/*.css';
}
return $this->getAssetUrls($inputs, $filters, $options);
}
/**
* Returns an array of one image url.
*/
public function image($inputs = array(), $filters = array(), array $options = array())
{
if (!isset($options['output'])) {
$options['output'] = 'images/*';
}
$options['single'] = true;
return $this->getAssetUrls($inputs, $filters, $options);
}
/**
* Gets the URLs for the configured asset.
*
* Usage looks something like this:
*
* <?php foreach ($view['assetic']->assets('@jquery, js/src/core/*', '?yui_js') as $url): ?>
* <script src="<?php echo $url ?>" type="text/javascript"></script>
* <?php endforeach; ?>
*
* When in debug mode, the helper returns an array of one or more URLs.
* When not in debug mode it returns an array of one URL.
*
* @param array|string $inputs An array or comma-separated list of input strings
* @param array|string $filters An array or comma-separated list of filter names
* @param array $options An array of options
*
* @return array An array of URLs for the asset
*/
private function getAssetUrls($inputs = array(), $filters = array(), array $options = array())
{
$explode = function ($value) {
return array_map('trim', explode(',', $value));
};
if (!is_array($inputs)) {
$inputs = $explode($inputs);
}
if (!is_array($filters)) {
$filters = $explode($filters);
}
if (!isset($options['debug'])) {
$options['debug'] = $this->factory->isDebug();
}
if (!isset($options['combine'])) {
$options['combine'] = !$options['debug'];
}
if (isset($options['single']) && $options['single'] && 1 < count($inputs)) {
$inputs = array_slice($inputs, -1);
}
if (!isset($options['name'])) {
$options['name'] = $this->factory->generateAssetName($inputs, $filters, $options);
}
$asset = $this->factory->createAsset($inputs, $filters, $options);
$one = $this->getAssetUrl($asset, $options);
$many = array();
if ($options['combine']) {
$many[] = $one;
} else {
$i = 0;
foreach ($asset as $leaf) {
$many[] = $this->getAssetUrl($leaf, array_replace($options, array(
'name' => $options['name'].'_'.$i++,
)));
}
}
return new TraversableString($one, $many);
}
/**
* Returns an URL for the supplied asset.
*
* @param AssetInterface $asset An asset
* @param array $options An array of options
*
* @return string An echo-ready URL
*/
abstract protected function getAssetUrl(AssetInterface $asset, $options = array());
public function getName()
{
return 'assetic';
}
}

View file

@ -0,0 +1,46 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Templating;
use Assetic\Asset\AssetInterface;
use Assetic\Factory\AssetFactory;
use Symfony\Bundle\FrameworkBundle\Templating\Helper\RouterHelper;
/**
* The dynamic "assetic" templating helper.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class DynamicAsseticHelper extends AsseticHelper
{
private $routerHelper;
/**
* Constructor.
*
* @param RouterHelper $routerHelper The router helper
* @param AssetFactory $factory The asset factory
*/
public function __construct(RouterHelper $routerHelper, AssetFactory $factory)
{
$this->routerHelper = $routerHelper;
parent::__construct($factory);
}
protected function getAssetUrl(AssetInterface $asset, $options = array())
{
return !method_exists($this->routerHelper, 'path')
? $this->routerHelper->generate('_assetic_'.$options['name'])
: $this->routerHelper->path('_assetic_'.$options['name']);
}
}

View file

@ -0,0 +1,62 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Templating;
use Assetic\Asset\AssetInterface;
use Assetic\Factory\AssetFactory;
use Symfony\Component\Asset\Packages;
use Symfony\Component\Templating\Helper\CoreAssetsHelper;
/**
* The static "assetic" templating helper.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class StaticAsseticHelper extends AsseticHelper
{
private $packages;
private $assetsHelper;
/**
* Constructor.
*
* @param Packages|CoreAssetsHelper $packages The assets packages
* @param AssetFactory $factory The asset factory
*/
public function __construct($packages, AssetFactory $factory)
{
// Symfony <2.7 BC
if (!$packages instanceof Packages && !$packages instanceof CoreAssetsHelper) {
}
if ($packages instanceof Packages) {
$this->packages = $packages;
} elseif ($packages instanceof CoreAssetsHelper) {
$this->assetsHelper = $packages;
} else {
throw new \InvalidArgumentException('Argument 1 passed to '.__METHOD__.' must be an instance of Symfony\Component\Asset\Packages or Symfony\Component\Templating\Helper\CoreAssetsHelper, instance of '.get_class($packages).' given');
}
parent::__construct($factory);
}
protected function getAssetUrl(AssetInterface $asset, $options = array())
{
$package = isset($options['package']) ? $options['package'] : null;
if (null === $this->packages) {
return $this->assetsHelper->getUrl($asset->getTargetPath(), $package);
}
return $this->packages->getPackage($package)->getUrl($asset->getTargetPath());
}
}

View file

@ -0,0 +1,51 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Tests\CacheWarmer;
use Symfony\Bundle\AsseticBundle\CacheWarmer\AssetManagerCacheWarmer;
class AssetManagerCacheWarmerTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
if (!class_exists('Assetic\\AssetManager')) {
$this->markTestSkipped('Assetic is not available.');
}
}
public function testWarmUp()
{
$am = $this
->getMockBuilder('Assetic\\Factory\\LazyAssetManager')
->disableOriginalConstructor()
->getMock()
;
$am->expects($this->once())->method('load');
$container = $this
->getMockBuilder('Symfony\\Component\\DependencyInjection\\Container')
->setConstructorArgs(array())
->getMock()
;
$container
->expects($this->once())
->method('get')
->with('assetic.asset_manager')
->will($this->returnValue($am))
;
$warmer = new AssetManagerCacheWarmer($container);
$warmer->warmUp('/path/to/cache');
}
}

View file

@ -0,0 +1,220 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Tests\Command;
use Symfony\Bundle\AsseticBundle\Command\DumpCommand;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\NullOutput;
class DumpCommandTest extends \PHPUnit_Framework_TestCase
{
private $writeTo;
private $application;
private $definition;
private $kernel;
private $container;
private $am;
private $helperSet;
/**
* @var DumpCommand
*/
private $command;
protected function setUp()
{
if (!class_exists('Assetic\\AssetManager')) {
$this->markTestSkipped('Assetic is not available.');
}
if (!class_exists('Symfony\Component\Console\Application')) {
$this->markTestSkipped('Symfony Console is not available.');
}
$this->writeTo = sys_get_temp_dir().'/assetic_dump';
$this->application = $this->getMockBuilder('Symfony\\Bundle\\FrameworkBundle\\Console\\Application')
->disableOriginalConstructor()
->getMock();
$this->definition = $this->getMockBuilder('Symfony\\Component\\Console\\Input\\InputDefinition')
->disableOriginalConstructor()
->getMock();
$this->kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->getMock();
$this->helperSet = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\HelperSet')->getMock();
$this->container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerInterface')->getMock();
$this->am = $this->getMockBuilder('Assetic\\Factory\\LazyAssetManager')
->disableOriginalConstructor()
->getMock();
$this->application->expects($this->any())
->method('getDefinition')
->will($this->returnValue($this->definition));
$this->definition->expects($this->any())
->method('getArguments')
->will($this->returnValue(array()));
$this->definition->expects($this->any())
->method('getOptions')
->will($this->returnValue(array(
new InputOption('--verbose', '-v', InputOption::VALUE_NONE, 'Increase verbosity of messages.'),
new InputOption('--env', '-e', InputOption::VALUE_REQUIRED, 'The Environment name.', 'dev'),
new InputOption('--no-debug', null, InputOption::VALUE_NONE, 'Switches off debug mode.'),
)));
$this->application->expects($this->any())
->method('getKernel')
->will($this->returnValue($this->kernel));
$this->application->expects($this->once())
->method('getHelperSet')
->will($this->returnValue($this->helperSet));
$this->kernel->expects($this->any())
->method('getContainer')
->will($this->returnValue($this->container));
$writeTo = $this->writeTo;
$this->container->expects($this->any())
->method('getParameter')
->will($this->returnCallback(function ($p) use ($writeTo) {
if ('assetic.write_to' === $p) {
return $writeTo;
} elseif ('assetic.variables' === $p) {
return array();
}
throw new \RuntimeException(sprintf('Unknown parameter "%s".', $p));
}));
$this->container->expects($this->once())
->method('get')
->with('assetic.asset_manager')
->will($this->returnValue($this->am));
$this->command = new DumpCommand();
$this->command->setApplication($this->application);
}
protected function tearDown()
{
if (is_dir($this->writeTo)) {
array_map('unlink', glob($this->writeTo.'/*'));
rmdir($this->writeTo);
}
}
public function testEmptyAssetManager()
{
$this->am->expects($this->once())
->method('getNames')
->will($this->returnValue(array()));
$this->command->run(new ArrayInput(array()), new NullOutput());
}
public function testDumpOne()
{
$asset = $this->getMockBuilder('Assetic\\Asset\\AssetInterface')->getMock();
$this->am->expects($this->once())
->method('getNames')
->will($this->returnValue(array('test_asset')));
$this->am->expects($this->once())
->method('get')
->with('test_asset')
->will($this->returnValue($asset));
$this->am->expects($this->once())
->method('hasFormula')
->with('test_asset')
->will($this->returnValue(true));
$this->am->expects($this->once())
->method('getFormula')
->with('test_asset')
->will($this->returnValue(array()));
$this->am->expects($this->exactly(2))
->method('isDebug')
->will($this->returnValue(false));
$asset->expects($this->once())
->method('getTargetPath')
->will($this->returnValue('test_asset.css'));
$asset->expects($this->once())
->method('dump')
->will($this->returnValue('/* test_asset */'));
$asset->expects($this->any())
->method('getVars')
->will($this->returnValue(array()));
$asset->expects($this->any())
->method('getValues')
->will($this->returnValue(array()));
$this->command->run(new ArrayInput(array()), new NullOutput());
$this->assertFileExists($this->writeTo.'/test_asset.css');
$this->assertEquals('/* test_asset */', file_get_contents($this->writeTo.'/test_asset.css'));
}
public function testDumpDebug()
{
$asset = $this->getMockBuilder('Assetic\\Asset\\AssetCollection')->getMock();
$leaf = $this->getMockBuilder('Assetic\\Asset\\AssetInterface')->getMock();
$this->am->expects($this->once())
->method('getNames')
->will($this->returnValue(array('test_asset')));
$this->am->expects($this->once())
->method('get')
->with('test_asset')
->will($this->returnValue($asset));
$this->am->expects($this->once())
->method('hasFormula')
->with('test_asset')
->will($this->returnValue(true));
$this->am->expects($this->once())
->method('getFormula')
->with('test_asset')
->will($this->returnValue(array()));
$this->am->expects($this->exactly(2))
->method('isDebug')
->will($this->returnValue(true));
$asset->expects($this->once())
->method('getTargetPath')
->will($this->returnValue('test_asset.css'));
$asset->expects($this->once())
->method('dump')
->will($this->returnValue('/* test_asset */'));
$asset->expects($this->once())
->method('getIterator')
->will($this->returnValue(new \ArrayIterator(array($leaf))));
$asset->expects($this->any())
->method('getVars')
->will($this->returnValue(array()));
$asset->expects($this->any())
->method('getValues')
->will($this->returnValue(array()));
$leaf->expects($this->once())
->method('getTargetPath')
->will($this->returnValue('test_leaf.css'));
$leaf->expects($this->once())
->method('dump')
->will($this->returnValue('/* test_leaf */'));
$leaf->expects($this->any())
->method('getVars')
->will($this->returnValue(array()));
$leaf->expects($this->any())
->method('getValues')
->will($this->returnValue(array()));
$this->command->run(new ArrayInput(array()), new NullOutput());
$this->assertFileExists($this->writeTo.'/test_asset.css');
$this->assertFileExists($this->writeTo.'/test_leaf.css');
$this->assertEquals('/* test_asset */', file_get_contents($this->writeTo.'/test_asset.css'));
$this->assertEquals('/* test_leaf */', file_get_contents($this->writeTo.'/test_leaf.css'));
}
}

View file

@ -0,0 +1,213 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Tests\Controller;
use Symfony\Bundle\AsseticBundle\Controller\AsseticController;
class AsseticControllerTest extends \PHPUnit_Framework_TestCase
{
private $request;
private $headers;
private $am;
private $cache;
private $controller;
protected function setUp()
{
if (!class_exists('Assetic\\AssetManager')) {
$this->markTestSkipped('Assetic is not available.');
}
$this->request = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\Request')->setMethods(array('getETags', 'getMethod'))->getMock();
$this->headers = $this->getMockBuilder('Symfony\\Component\\HttpFoundation\\ParameterBag')->getMock();
$this->request->headers = $this->headers;
$this->am = $this->getMockBuilder('Assetic\\Factory\\LazyAssetManager')
->disableOriginalConstructor()
->getMock();
$this->cache = $this->getMockBuilder('Assetic\\Cache\\CacheInterface')->getMock();
$this->request->expects($this->any())
->method('getMethod')
->willReturn('GET');
$this->controller = new AsseticController($this->am, $this->cache);
}
public function testRenderNotFound()
{
$this->setExpectedException('Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException');
$name = 'foo';
$this->am->expects($this->once())
->method('has')
->with($name)
->will($this->returnValue(false));
$this->controller->render($this->request, $name);
}
public function testRenderLastModifiedFresh()
{
$asset = $this->getMockBuilder('Assetic\\Asset\\AssetInterface')->getMock();
$name = 'foo';
$lastModified = strtotime('2010-10-10 10:10:10');
$ifModifiedSince = gmdate('D, d M Y H:i:s', $lastModified).' GMT';
$asset->expects($this->any())
->method('getFilters')
->will($this->returnValue(array()));
$this->am->expects($this->any())
->method('has')
->with($name)
->will($this->returnValue(true));
$this->am->expects($this->any())
->method('get')
->with($name)
->will($this->returnValue($asset));
$this->am->expects($this->any())
->method('getLastModified')
->with($asset)
->will($this->returnValue($lastModified));
$this->headers->expects($this->any())
->method('get')
->with('If-Modified-Since')
->will($this->returnValue($ifModifiedSince));
$asset->expects($this->never())
->method('dump');
$response = $this->controller->render($this->request, $name);
$this->assertEquals(304, $response->getStatusCode(), '->render() sends a Not Modified response when If-Modified-Since is fresh');
}
public function testRenderLastModifiedStale()
{
$asset = $this->getMockBuilder('Assetic\\Asset\\AssetInterface')->getMock();
$name = 'foo';
$content = '==ASSET_CONTENT==';
$lastModified = strtotime('2010-10-10 10:10:10');
$ifModifiedSince = gmdate('D, d M Y H:i:s', $lastModified - 300).' GMT';
$asset->expects($this->any())
->method('getFilters')
->will($this->returnValue(array()));
$this->am->expects($this->any())
->method('has')
->with($name)
->will($this->returnValue(true));
$this->am->expects($this->any())
->method('get')
->with($name)
->will($this->returnValue($asset));
$this->am->expects($this->any())
->method('getLastModified')
->with($asset)
->will($this->returnValue($lastModified));
$this->headers->expects($this->any())
->method('get')
->with('If-Modified-Since')
->will($this->returnValue($ifModifiedSince));
$this->cache->expects($this->any())
->method('has')
->with($this->isType('string'))
->will($this->returnValue(false));
$asset->expects($this->once())
->method('dump')
->will($this->returnValue($content));
$response = $this->controller->render($this->request, $name);
$this->assertEquals(200, $response->getStatusCode(), '->render() sends an OK response when If-Modified-Since is stale');
$this->assertEquals($content, $response->getContent(), '->render() sends the dumped asset as the response content');
}
public function testRenderETagFresh()
{
$asset = $this->getMockBuilder('Assetic\\Asset\\AssetInterface')->getMock();
$name = 'foo';
$formula = array(array('js/core.js'), array(), array(''));
$etag = md5(serialize($formula + array('last_modified' => null)));
$asset->expects($this->any())
->method('getFilters')
->will($this->returnValue(array()));
$this->am->expects($this->any())
->method('has')
->with($name)
->will($this->returnValue(true));
$this->am->expects($this->any())
->method('get')
->with($name)
->will($this->returnValue($asset));
$this->am->expects($this->any())
->method('hasFormula')
->with($name)
->will($this->returnValue(true));
$this->am->expects($this->any())
->method('getFormula')
->with($name)
->will($this->returnValue($formula));
$this->request->expects($this->any())
->method('getETags')
->will($this->returnValue(array('"'.$etag.'"')));
$asset->expects($this->never())
->method('dump');
$response = $this->controller->render($this->request, $name);
$this->assertEquals(304, $response->getStatusCode(), '->render() sends a Not Modified response when If-None-Match is fresh');
}
public function testRenderETagStale()
{
$asset = $this->getMockBuilder('Assetic\\Asset\\AssetInterface')->getMock();
$name = 'foo';
$content = '==ASSET_CONTENT==';
$formula = array(array('js/core.js'), array(), array(''));
$asset->expects($this->any())
->method('getFilters')
->will($this->returnValue(array()));
$this->am->expects($this->once())
->method('has')
->with($name)
->will($this->returnValue(true));
$this->am->expects($this->once())
->method('get')
->with($name)
->will($this->returnValue($asset));
$this->am->expects($this->once())
->method('hasFormula')
->with($name)
->will($this->returnValue(true));
$this->am->expects($this->once())
->method('getFormula')
->with($name)
->will($this->returnValue($formula));
$this->request->expects($this->once())
->method('getETags')
->will($this->returnValue(array('"123"')));
$asset->expects($this->once())
->method('dump')
->will($this->returnValue($content));
$response = $this->controller->render($this->request, $name);
$this->assertEquals(200, $response->getStatusCode(), '->render() sends an OK response when If-None-Match is stale');
$this->assertEquals($content, $response->getContent(), '->render() sends the dumped asset as the response content');
}
}

View file

@ -0,0 +1,299 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Tests\DependencyInjection;
use Symfony\Bundle\AsseticBundle\DependencyInjection\AsseticExtension;
use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\CheckClosureFilterPass;
use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\CheckYuiFilterPass;
use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\StaticAsseticHelperPass;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Scope;
use Symfony\Component\HttpFoundation\Request;
class AsseticExtensionTest extends \PHPUnit_Framework_TestCase
{
private $kernel;
/**
* @var ContainerBuilder
*/
private $container;
public static function assertSaneContainer(Container $container, $message = '')
{
$errors = array();
foreach ($container->getServiceIds() as $id) {
try {
$container->get($id);
} catch (\Exception $e) {
$errors[$id] = $e->getMessage();
}
}
self::assertSame(array(), $errors, $message);
}
protected function setUp()
{
if (!class_exists('Assetic\\AssetManager')) {
$this->markTestSkipped('Assetic is not available.');
}
if (!class_exists('Twig_Environment')) {
$this->markTestSkipped('Twig is not available.');
}
$this->kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->getMock();
$this->container = new ContainerBuilder();
// Symfony 2.3 BC
if (!method_exists('Symfony\Component\DependencyInjection\Definition', 'setShared')) {
$this->container->addScope(new Scope('request'));
$this->container->register('request', 'Symfony\\Component\\HttpFoundation\\Request')->setScope('request');
}
// Symfony <2.7 BC
if (class_exists('Symfony\\Bundle\\FrameworkBundle\\Templating\\Helper\\AssetsHelper')) {
$this->container->register('assets.packages', $this->getMockClass('Symfony\\Component\\Asset\\Packages'));
$this->container->register('templating.helper.assets', $this->getMockClass('Symfony\\Bundle\\FrameworkBundle\\Templating\\Helper\\AssetsHelper'))
->addArgument(new Reference('assets.packages'));
} elseif (class_exists('Symfony\\Component\\Templating\\Helper\\CoreAssetsHelper')) {
$this->container->register('templating.helper.assets', $this->getMockClass('Symfony\\Component\\Templating\\Helper\\CoreAssetsHelper'))
->addArgument(new Definition($this->getMockClass('Symfony\Component\Templating\Asset\PackageInterface')));
}
$this->container->register('templating.helper.router', $this->getMockClass('Symfony\\Bundle\\FrameworkBundle\\Templating\\Helper\\RouterHelper'))
->addArgument(new Definition($this->getMockClass('Symfony\\Component\\Routing\\RouterInterface')));
$this->container->register('twig', 'Twig_Environment')
->addArgument(new Definition($this->getMockClass('Twig_LoaderInterface')));
$this->container->setParameter('kernel.bundles', array());
$this->container->setParameter('kernel.cache_dir', __DIR__);
$this->container->setParameter('kernel.debug', false);
$this->container->setParameter('kernel.root_dir', __DIR__);
$this->container->setParameter('kernel.charset', 'UTF-8');
$this->container->set('kernel', $this->kernel);
$this->container->addCompilerPass(new StaticAsseticHelperPass());
}
/**
* @dataProvider getDebugModes
*/
public function testDefaultConfig($debug)
{
$this->container->setParameter('kernel.debug', $debug);
$extension = new AsseticExtension();
$extension->load(array(array()), $this->container);
$this->assertFalse($this->container->has('assetic.filter.yui_css'), '->load() does not load the yui_css filter when a yui value is not provided');
$this->assertFalse($this->container->has('assetic.filter.yui_js'), '->load() does not load the yui_js filter when a yui value is not provided');
$this->assertSaneContainer($this->getDumpedContainer());
}
public function getDebugModes()
{
return array(
array(true),
array(false),
);
}
/**
* @dataProvider getFilterNames
*/
public function testFilterConfigs($name, $config = array())
{
$extension = new AsseticExtension();
$extension->load(array(array('filters' => array($name => $config))), $this->container);
$this->assertSaneContainer($this->getDumpedContainer());
}
public function getFilterNames()
{
return array(
array('autoprefixer'),
array('closure', array('jar' => '/path/to/closure.jar')),
array('coffee'),
array('compass'),
array('csscachebusting'),
array('cssembed', array('jar' => '/path/to/cssembed.jar')),
array('cssimport'),
array('cssmin'),
array('cssrewrite'),
array('dart'),
array('emberprecompile'),
array('gss'),
array('handlebars'),
array('jpegoptim'),
array('jpegtran'),
array('jsmin'),
array('jsminplus'),
array('jsqueeze'),
array('less'),
array('lessphp'),
array('minifycsscompressor'),
array('optipng'),
array('packager'),
array('packer'),
array('phpcssembed'),
array('pngout'),
array('roole'),
array('sass'),
array('scss'),
array('scssphp', array('compass' => true)),
array('sprockets', array('include_dirs' => array('foo'))),
array('stylus'),
array('typescript'),
array('uglifycss'),
array('uglifyjs'),
array('uglifyjs2'),
array('yui_css', array('jar' => '/path/to/yuicompressor.jar')),
array('yui_js', array('jar' => '/path/to/yuicompressor.jar')),
);
}
/**
* @dataProvider getUseControllerKeys
*/
public function testUseController($bool, $includes, $omits)
{
$extension = new AsseticExtension();
$extension->load(array(array('use_controller' => $bool)), $this->container);
foreach ($includes as $id) {
$this->assertTrue($this->container->has($id), '"'.$id.'" is registered when use_controller is '.$bool);
}
foreach ($omits as $id) {
$this->assertFalse($this->container->has($id), '"'.$id.'" is not registered when use_controller is '.$bool);
}
$this->assertSaneContainer($this->getDumpedContainer());
}
public function getUseControllerKeys()
{
return array(
array(true, array('assetic.routing_loader', 'assetic.controller'), array()),
array(false, array(), array('assetic.routing_loader', 'assetic.controller')),
);
}
/**
* @dataProvider getCacheBustingWorkerKeys
*/
public function testCacheBustingWorker($enabled)
{
$extension = new AsseticExtension();
$extension->load(array(array('workers' => array('cache_busting' => array('enabled' => $enabled)))), $this->container);
$def = $this->container->getDefinition('assetic.worker.cache_busting');
$this->assertSame($enabled, $def->hasTag('assetic.factory_worker'));
$this->assertSaneContainer($this->getDumpedContainer());
}
public function getCacheBustingWorkerKeys()
{
return array(
array(true),
array(false),
);
}
/**
* @dataProvider getClosureJarAndExpected
*/
public function testClosureCompilerPass($jar, $expected)
{
$this->container->addCompilerPass(new CheckClosureFilterPass());
$extension = new AsseticExtension();
$extension->load(array(array(
'filters' => array(
'closure' => array('jar' => $jar),
),
)), $this->container);
$container = $this->getDumpedContainer();
$this->assertSaneContainer($container);
$this->assertTrue($this->container->getDefinition($expected)->hasTag('assetic.filter'));
$this->assertNotEmpty($container->getParameter('assetic.filter.closure.java'));
}
public function getClosureJarAndExpected()
{
return array(
array(null, 'assetic.filter.closure.api'),
array('/path/to/closure.jar', 'assetic.filter.closure.jar'),
);
}
public function testInvalidYuiConfig()
{
$this->setExpectedException('RuntimeException', 'assetic.filters.yui_js');
$this->container->addCompilerPass(new CheckYuiFilterPass());
$extension = new AsseticExtension();
$extension->load(array(array(
'filters' => array(
'yui_js' => array(),
),
)), $this->container);
$this->getDumpedContainer();
}
/**
* @return Container
*/
private function getDumpedContainer()
{
static $i = 0;
$class = 'AsseticExtensionTestContainer'.$i++;
$this->container->compile();
$dumper = new PhpDumper($this->container);
eval('?>'.$dumper->dump(array('class' => $class)));
$container = new $class();
// Symfony 2.3 BC
if (!method_exists('Symfony\Component\DependencyInjection\Definition', 'setShared')) {
$container->enterScope('request');
$container->set('request', Request::create('/'));
}
$container->set('kernel', $this->kernel);
return $container;
}
public function testCompassCanBeEnabled()
{
$extension = new AsseticExtension();
$extension->load(array(array(
'filters' => array(
'scssphp' => array('compass' => true),
),
)), $this->container);
$this->assertTrue($this->container->get('assetic.filter.scssphp')->isCompassEnabled());
//$this->getDumpedContainer();
}
}

View file

@ -0,0 +1,98 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Tests\Factory;
use Symfony\Bundle\AsseticBundle\Factory\AssetFactory;
class AssetFactoryTest extends \PHPUnit_Framework_TestCase
{
private $kernel;
private $factory;
private $parameterBag;
private $container;
protected function setUp()
{
if (!class_exists('Assetic\\AssetManager')) {
$this->markTestSkipped('Assetic is not available.');
}
$this->kernel = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\KernelInterface')->getMock();
$this->container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerInterface')->getMock();
$this->parameterBag = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBagInterface')->getMock();
$this->factory = new AssetFactory($this->kernel, $this->container, $this->parameterBag, '/path/to/web');
}
public function testBundleNotation()
{
$input = '@MyBundle/Resources/css/main.css';
$bundle = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface')->getMock();
$this->parameterBag->expects($this->once())
->method('resolveValue')
->will($this->returnCallback(function ($v) { return $v; }));
$this->kernel->expects($this->once())
->method('getBundle')
->with('MyBundle')
->will($this->returnValue($bundle));
$this->kernel->expects($this->once())
->method('locateResource')
->with($input)
->will($this->returnValue('/path/to/MyBundle/Resources/css/main.css'));
$bundle->expects($this->once())
->method('getPath')
->will($this->returnValue('/path/to/MyBundle'));
$coll = $this->factory->createAsset($input)->all();
$asset = $coll[0];
$this->assertEquals('/path/to/MyBundle', $asset->getSourceRoot(), '->createAsset() sets the asset root');
$this->assertEquals('Resources/css/main.css', $asset->getSourcePath(), '->createAsset() sets the asset path');
}
/**
* @dataProvider getGlobs
*/
public function testBundleGlobNotation($input)
{
$bundle = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface')->getMock();
$this->parameterBag->expects($this->once())
->method('resolveValue')
->will($this->returnCallback(function ($v) { return $v; }));
$this->kernel->expects($this->once())
->method('getBundle')
->with('MyBundle')
->will($this->returnValue($bundle));
$this->kernel->expects($this->once())
->method('locateResource')
->with('@MyBundle/Resources/css/')
->will($this->returnValue('/path/to/MyBundle/Resources/css/'));
$bundle->expects($this->once())
->method('getPath')
->will($this->returnValue('/path/to/MyBundle'));
$coll = $this->factory->createAsset($input)->all();
$asset = $coll[0];
$this->assertEquals('/path/to/MyBundle', $asset->getSourceRoot(), '->createAsset() sets the asset root');
$this->assertNull($asset->getSourcePath(), '->createAsset() sets the asset path to null');
}
public function getGlobs()
{
return array(
array('@MyBundle/Resources/css/*'),
array('@MyBundle/Resources/css/*/*.css'),
);
}
}

View file

@ -0,0 +1,63 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Tests\Factory\Resource;
use Symfony\Bundle\AsseticBundle\Factory\Resource\CoalescingDirectoryResource;
class CoalescingDirectoryResourceTest extends \PHPUnit_Framework_TestCase
{
public function testFiltering()
{
$dir1 = $this->getMockBuilder('Assetic\\Factory\\Resource\\IteratorResourceInterface')->getMock();
$file1a = $this->getMockBuilder('Assetic\\Factory\\Resource\\ResourceInterface')->getMock();
$file1b = $this->getMockBuilder('Assetic\\Factory\\Resource\\ResourceInterface')->getMock();
$dir2 = $this->getMockBuilder('Assetic\\Factory\\Resource\\IteratorResourceInterface')->getMock();
$file2a = $this->getMockBuilder('Assetic\\Factory\\Resource\\ResourceInterface')->getMock();
$file2c = $this->getMockBuilder('Assetic\\Factory\\Resource\\ResourceInterface')->getMock();
$dir1->expects($this->any())
->method('getIterator')
->will($this->returnValue(new \ArrayIterator(array($file1a, $file1b))));
$file1a->expects($this->any())
->method('__toString')
->will($this->returnValue('FooBundle:Foo:file1.foo.bar'));
$file1b->expects($this->any())
->method('__toString')
->will($this->returnValue('FooBundle:Foo:file2.foo.bar'));
$dir2->expects($this->any())
->method('getIterator')
->will($this->returnValue(new \ArrayIterator(array($file2a, $file2c))));
$file2a->expects($this->any())
->method('__toString')
->will($this->returnValue('BarBundle:Foo:file1.foo.bar'));
$file2c->expects($this->any())
->method('__toString')
->will($this->returnValue('BarBundle:Foo:file3.foo.bar'));
$resource = new CoalescingDirectoryResource(array($dir1, $dir2));
$actual = array();
foreach ($resource as $file) {
$actual[] = (string) $file;
}
$expected = array(
'FooBundle:Foo:file1.foo.bar',
'FooBundle:Foo:file2.foo.bar',
'BarBundle:Foo:file3.foo.bar',
);
$this->assertEquals($expected, $actual);
}
}

View file

@ -0,0 +1,31 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Tests\Factory\Resource;
use Symfony\Bundle\AsseticBundle\Factory\Resource\FileResource;
class FileResourceTest extends \PHPUnit_Framework_TestCase
{
private $loader;
protected function setUp()
{
$this->loader = $this->getMockBuilder('Symfony\\Component\\Templating\\Loader\\LoaderInterface')->getMock();
}
public function testCastAsString()
{
$baseDir = '/path/to/MyBundle/Resources/views/';
$resource = new FileResource($this->loader, 'MyBundle', $baseDir, $baseDir.'Section/template.html.twig');
$this->assertEquals('MyBundle:Section:template.html.twig', (string) $resource);
}
}

View file

@ -0,0 +1,59 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Tests;
use Symfony\Bundle\AsseticBundle\FilterManager;
class FilterManagerTest extends \PHPUnit_Framework_TestCase
{
protected function setUp()
{
if (!class_exists('Assetic\\AssetManager')) {
$this->markTestSkipped('Assetic is not available.');
}
}
public function testGet()
{
$container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerInterface')->getMock();
$filter = $this->getMockBuilder('Assetic\\Filter\\FilterInterface')->getMock();
$container->expects($this->exactly(2))
->method('get')
->with('assetic.filter.bar')
->will($this->returnValue($filter));
$fm = new FilterManager($container, array('foo' => 'assetic.filter.bar'));
$this->assertSame($filter, $fm->get('foo'), '->get() loads the filter from the container');
$this->assertSame($filter, $fm->get('foo'), '->get() loads the filter from the container');
}
public function testHas()
{
$container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerInterface')->getMock();
$fm = new FilterManager($container, array('foo' => 'assetic.filter.bar'));
$this->assertTrue($fm->has('foo'), '->has() returns true for lazily mapped filters');
}
public function testGetNames()
{
$container = $this->getMockBuilder('Symfony\\Component\\DependencyInjection\\ContainerInterface')->getMock();
$filter = $this->getMockBuilder('Assetic\\Filter\\FilterInterface')->getMock();
$fm = new FilterManager($container, array('foo' => 'assetic.filter.bar'));
$fm->set('bar', $filter);
$this->assertEquals(array('foo', 'bar'), $fm->getNames(), '->getNames() returns all lazy and normal filter names');
}
}

View file

@ -0,0 +1,75 @@
<?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Tests;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\Request;
/**
* @group functional
*/
class FunctionalTest extends \PHPUnit_Framework_TestCase
{
private $cacheDir;
protected function setUp()
{
if (!class_exists('Assetic\\AssetManager')) {
$this->markTestSkipped('Assetic is not available.');
}
if (!class_exists('Symfony\Component\ClassLoader\ClassLoader')) {
$this->markTestSkipped('Symfony ClassLoader is not available.');
}
$this->cacheDir = __DIR__.'/Resources/cache';
if (file_exists($this->cacheDir)) {
$filesystem = new Filesystem();
$filesystem->remove($this->cacheDir);
}
mkdir($this->cacheDir, 0777, true);
}
protected function tearDown()
{
$filesystem = new Filesystem();
$filesystem->remove($this->cacheDir);
}
public function testTwigRenderDebug()
{
$kernel = new TestKernel('test', true);
$kernel->boot();
$container = $kernel->getContainer();
$content = $container->get('templating')->render('::layout.html.twig');
$crawler = new Crawler($content);
$this->assertEquals(3, count($crawler->filter('link[href$=".css"]')));
$this->assertEquals(2, count($crawler->filter('script[src$=".js"]')));
}
public function testPhpRenderDebug()
{
$kernel = new TestKernel('test', true);
$kernel->boot();
$container = $kernel->getContainer();
$content = $container->get('templating')->render('::layout.html.php');
$crawler = new Crawler($content);
$this->assertEquals(3, count($crawler->filter('link[href$=".css"]')));
$this->assertEquals(2, count($crawler->filter('script[src$=".js"]')));
}
}

View file

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title><?php $view['slots']->output('title') ?></title>
<?php $view['slots']->output('stylesheets') ?>
</head>
<body>
<?php $view['slots']->output('_content') ?>
<?php $view['slots']->output('javascripts') ?>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show more