Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use a filter on all compress blocks except for one?

In my settings for compressor I'm using SlimIt for most of my javascript:

COMPRESS_JS_FILTERS = ['compressor.filters.jsmin.SlimItFilter', ]

Some of my js files shouldn't go through SlimIt though because the file is already minified, or the javascript throws some error when its minified with other files. My template block ends up looking like this:

{# code that I minify #}
{% block compressed_libs %}
    {% compress js %}
        <script src="/static/js/compress_this.js"></script>
        <script src="/static/js/also_compress_this.js"></script>
        ...
    {% endcompress %}
{% endblock %}

{# code that shouldn't minify #}
{% block non-compressible_libs %}
    <script src="/static/js/already.min.js"></script>
    <script src="/static/js/breaks-everything.js"></script>
{% endblock %}

Can I set different compress filter rules for different blocks/files so that my "non-compressible" files can still be concatenated together by compressor while skipping SlimIt?

like image 759
petroleyum Avatar asked Jul 21 '15 18:07

petroleyum


People also ask

What is block filtering?

Category web content filtering is used to block websites based on content categories such as pornography, violence, hate, and social networking sites.

What is the use of Apply filter?

You can apply filters to a page report so as to narrow down the data displayed in the report. The filters can be applied to the business views used by data components such as banded objects, tables, crosstabs and charts in the report, or to the data components themselves.

What is Apply_filters?

apply_filters($tag,$value); allows you to create a place in your code where you can then allow the $value you pass to be hooked into and modified by using add_filter();

How do I add a filter in WordPress?

The process of adding a filter includes two steps. First, you need to create a Callback function which will be called when the filter is run. Second, you need to add your Callback function to a hook which will perform the calling of the function.

Can I use more than one air compressor filter?

In some cases, you can use more than one filter in a single compressor to target many particulates. Each type is applicable as an inline air compressor filter, which attaches to the air output on your tank and catches particulates before they move on to your pneumatic tools.

How to choose an inline filter for your air compressor?

Several elements contribute to how to choose an inline filter for your air compressor. One of the more significant factors is the type of compressor you’re using. Each variety will have specific requirements and fittings, and if you want the best results, it’s essential to find the most secure and proper fit.

Is there a way to disable filter for only one page?

There is no out-of-the-box feature in Power BI to disable filter for only 1 page. You can either have this filter as 'Page level Filter' on all pages or use ALL for this column (filter) for the measures on that single page. 03-30-2020 01:15 AM

Do I need an intake filter for my air compressor?

If your compressor doesn’t have one, installing one is essential. Intake filters pull out some of the harsher particulates, protecting the internal components of your processor, and clean the air before the pump releases it into the compressor system.


1 Answers

As approxiblue said, it doesn't look there's a way to specify which filters to use per compress block in a template (in Compressor 1.5).

I'll update this answer someone comes up with something.

It seems like this could be solved by adding a parameter to the compress template tag to allow it to return a CompressorNode with a flag to skip the filter in base.py hunks()

I'll see what the Compressor community thinks about this, but let me know if you have any ideas.

like image 114
petroleyum Avatar answered Oct 23 '22 20:10

petroleyum