Skip to content


How can I specify filter ordering? #141

pschultz opened this Issue · 1 comment

2 participants


I implemented a custom filter that should pre-process my less files before they are compiled to css. The filter is called as expected, but it is invoked to late in the filter chain, after the less filter.

The service definition looks like this:

    cm_lnf.customize_boostrap_filter.class: Classmarkets\LookAndFeelBundle\Assetic\Filter\CustomizeBootstrapFilter

    assetic.filter.customize_boostrap:        # workaround for assetic to accept our filter
        class: "%cm_lnf.customize_boostrap_filter.class%"
            - { name: assetic.filter, alias: customize_boostrap }                                                     

I tried to change the filter order by adding it to assetic.filters in app/config/config.yml (using the workaround described in #50) but that did not seem to change the order in which the filters are called:

    debug:          "%kernel.debug%"
    use_controller: false
    node: "%node%"
        cssrewrite: ~
            resource: 'assetic.xml'     # workaround for assetic to accept our filter
            apply_to: "bootstrap\.less$"
            node_paths: [ "%kernel.root_dir%/../node_modules" ]
            apply_to: "\.less$"

I also tried making the order explicit in the template, apparently without effect:

      {% stylesheets filter='customize_boostrap, less'
          <link href="{{ asset_url }}" type="text/css" rel="stylesheet">
        {% endstylesheets %}

Then I skimmed briefly through the code, but couldn't find a hint on how to influence filter priority / ordering. Is there an option that I missed? I can't quite believe that this is impossible.


I think it's probably alphabetical - but I too would love an answer to this one.

I have an instance that will be common in our system where the LessPHP filter is applied before our parser's filter and it jacks things up pretty bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.