Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AsseticBundle] moved filters into individual config files which must…
… be explicitly loaded You must now explicitly load those filters you want to use in your app. Some filters have additional configuration options: assetic: filters: cssrewrite: ~ yui_css: { jar: "/path/to/yuicompressor.jar" } You can also register your own filters now by referencing a configuration file: assetic: filters: my_filter: resource: "%kernel.root_dir%/config/my_filter.xml" foo: bar This configuration would load the referenced configuration file and set the "assetic.filter.my_filter.foo" parameter to "bar"
- Loading branch information
1 parent
260efb3
commit 04a257d
Showing
18 changed files
with
372 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/CheckClosureFilterPass.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?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; | ||
|
||
/** | ||
* Tags either the closure JAR or API filter for the filter manager. | ||
* | ||
* @author Kris Wallsmith <kris.wallsmith@symfony.com> | ||
*/ | ||
class CheckClosureFilterPass implements CompilerPassInterface | ||
{ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
if ($container->hasDefinition('assetic.filter.closure.jar') && | ||
$container->getParameterBag()->resolveValue($container->getParameter('assetic.filter.closure.jar'))) { | ||
$container->remove('assetic.filter.closure.api'); | ||
} elseif ($container->hasDefinition('assetic.filter.closure.api')) { | ||
$container->remove('assetic.filter.closure.jar'); | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/Symfony/Bundle/AsseticBundle/DependencyInjection/Compiler/CheckYuiFilterPass.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
|
||
/** | ||
* Checks that the location of the YUI JAR has been configured. | ||
* | ||
* @author Kris Wallsmith <kris.wallsmith@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 "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 "yui_js" configuration requires a "jar" value.'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/Symfony/Bundle/AsseticBundle/Resources/config/filters/closure.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.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.jar">%assetic.closure.jar%</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> | ||
</service> | ||
|
||
<service id="assetic.filter.closure.api" class="%assetic.filter.closure.api.class%"> | ||
<tag name="assetic.filter" alias="closure" /> | ||
</service> | ||
</services> | ||
</container> |
20 changes: 20 additions & 0 deletions
20
src/Symfony/Bundle/AsseticBundle/Resources/config/filters/coffee.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.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> | ||
</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> | ||
</service> | ||
</services> | ||
</container> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/Symfony/Bundle/AsseticBundle/Resources/config/filters/less.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.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> | ||
</parameters> | ||
|
||
<services> | ||
<service id="assetic.filter.less" class="%assetic.filter.less.class%"> | ||
<tag name="assetic.filter" alias="less" /> | ||
<argument>%assetic.read_from%</argument> | ||
<argument>%assetic.filter.less.node%</argument> | ||
<argument>%assetic.filter.less.node_paths%</argument> | ||
</service> | ||
</services> | ||
</container> |
18 changes: 18 additions & 0 deletions
18
src/Symfony/Bundle/AsseticBundle/Resources/config/filters/sass.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.sass.class">Assetic\Filter\Sass\SassFilter</parameter> | ||
<parameter key="assetic.filter.sass.bin">%assetic.sass.bin%</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> | ||
</service> | ||
</services> | ||
</container> |
Oops, something went wrong.