문제

I would like to create my own Assetic filter similar to those LESS, SASS and Google Closure Compiler filters.

I can see that the filters are in vendor/assetic/src/Assetic/Filter, but obviously I can't just modify that codebase.

도움이 되었습니까?

해결책

The right way should be to create a service that encapsulate your business logic inside the DIC and to tag it with the assetic.filter_manager tag.

For example the builtin coffee script filter is registered this way:

<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>

Modifying the code base is definitely the wrong way to do something like this, symfony DIC provide much better solutions!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top