Permalink
Browse files

added support for configuring sprockets include dirs

  • Loading branch information...
1 parent 455e176 commit 61bc7f32c663a9c7be53ed761a574a1509f74d7e @kriswallsmith kriswallsmith committed Jul 10, 2011
View
@@ -18,6 +18,7 @@
use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\CheckCssEmbedFilterPass;
use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\CheckClosureFilterPass;
use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\TemplatingPass;
+use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\SprocketsFilterPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
@@ -35,6 +36,7 @@ public function build(ContainerBuilder $container)
$container->addCompilerPass(new CheckClosureFilterPass());
$container->addCompilerPass(new CheckCssEmbedFilterPass());
$container->addCompilerPass(new CheckYuiFilterPass());
+ $container->addCompilerPass(new SprocketsFilterPass());
$container->addCompilerPass(new TemplatingPass());
$container->addCompilerPass(new AssetFactoryPass());
$container->addCompilerPass(new AssetManagerPass());
@@ -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\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
+
+/**
+ * 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));
+ }
+ }
+}
@@ -8,6 +8,7 @@
<parameter key="assetic.filter.sprockets.class">Assetic\Filter\SprocketsFilter</parameter>
<parameter key="assetic.filter.sprockets.bin">/usr/bin/sprocketize</parameter>
<parameter key="assetic.filter.sprockets.asset_root">%assetic.write_to%</parameter>
+ <parameter key="assetic.filter.sprockets.include_dirs" type="collection" />
</parameters>
<services>
@@ -116,7 +116,7 @@ public function getFilterNames()
array('pngout'),
array('sass'),
array('scss'),
- array('sprockets'),
+ array('sprockets', array('include_dirs' => array('foo'))),
array('stylus'),
array('yui_css', array('jar' => '/path/to/yuicompressor.jar')),
array('yui_js', array('jar' => '/path/to/yuicompressor.jar')),

0 comments on commit 61bc7f3

Please sign in to comment.