forked from symfony/assetic-bundle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote branch 'kriswallsmith/assetic/explicit-filter-config'
* kriswallsmith/assetic/explicit-filter-config: [AsseticBundle] added lessphp filter [AsseticBundle] added config for image filters [AsseticBundle] moved filters into individual config files which must be explicitly loaded [AsseticBundle] removed configuration of default output strings
- Loading branch information
Showing
25 changed files
with
461 additions
and
106 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
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 <[email protected]> | ||
* | ||
* 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 <[email protected]> | ||
*/ | ||
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'); | ||
} | ||
} | ||
} |
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 <[email protected]> | ||
* | ||
* 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 <[email protected]> | ||
*/ | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
* sections are normalized, and merged. | ||
* | ||
* @author Christophe Coevoet <[email protected]> | ||
* @author Kris Wallsmith <[email protected]> | ||
*/ | ||
class Configuration | ||
{ | ||
|
@@ -41,28 +42,38 @@ public function getConfigTree($debug, array $bundles) | |
->booleanNode('use_controller')->defaultValue($debug)->end() | ||
->scalarNode('read_from')->defaultValue('%kernel.root_dir%/../web')->end() | ||
->scalarNode('write_to')->defaultValue('%assetic.read_from%')->end() | ||
->scalarNode('closure')->end() | ||
->scalarNode('yui')->end() | ||
->scalarNode('default_javascripts_output')->defaultValue('js/*.js')->end() | ||
->scalarNode('default_stylesheets_output')->defaultValue('css/*.css')->end() | ||
->scalarNode('closure')->defaultNull()->end() | ||
->scalarNode('java')->defaultNull()->end() | ||
->scalarNode('node')->defaultNull()->end() | ||
->scalarNode('sass')->defaultNull()->end() | ||
->scalarNode('yui')->defaultNull()->end() | ||
->end() | ||
->fixXmlConfig('bundle') | ||
->children() | ||
->arrayNode('bundles') | ||
->defaultValue($bundles) | ||
->requiresAtLeastOneElement() | ||
->beforeNormalization() | ||
->ifTrue(function($v){ return !is_array($v); }) | ||
->then(function($v){ return array($v); }) | ||
->ifTrue(function($v) { return !is_array($v); }) | ||
->then(function($v) { return array($v); }) | ||
->end() | ||
->prototype('scalar') | ||
->beforeNormalization() | ||
->ifTrue(function($v) { return is_array($v) && isset($v['name']); }) | ||
->then(function($v){ return $v['name']; }) | ||
->then(function($v) { return $v['name']; }) | ||
->end() | ||
->end() | ||
->end() | ||
->end() | ||
->fixXmlConfig('filter') | ||
->children() | ||
->arrayNode('filters') | ||
->addDefaultsIfNotSet() | ||
->requiresAtLeastOneElement() | ||
->useAttributeAsKey('name') | ||
->prototype('array')->end() | ||
->end() | ||
->end() | ||
; | ||
|
||
return $tree->buildTree(); | ||
|
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
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> |
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
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.jpegtran.class">Assetic\Filter\JpegtranFilter</parameter> | ||
<parameter key="assetic.filter.jpegtran.bin">/usr/bin/jpegtran</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> | ||
</service> | ||
</services> | ||
</container> |
Oops, something went wrong.