Symfony2 minify without java or node

I do not have access to java or node on my shared host. Is there a way to minimize the server side, so I can continue to use assetic without these engines? Uglify uses node, and yui-compressor (deprecated) uses java.

Thanks!

+7
symfony minify
source share
3 answers

There seem to be 2 filters using only PHP code:

You will need to install the pha minify library through the composer and then use the cssmin and jsminplus attribute filters.

+16
source share

Just to clarify the steps:

  • composer require mrclay/minify
  • In symfony app/config/config.yml add to assetic config:

    # some stuff assetic: filters: # possible another filters minifycsscompressor: ~ jsminplus: ~

    1. In the branch:

{% stylesheets <your assets> filter='minifycsscompressor' %} <link rel="stylesheet" href="{{ asset_url }}"> {% endstylesheets %}

{% javascripts <your assets> filter='jsminplus' %} <script src="{{ asset_url }}"></script> {% endjavascripts %}

+3
source share

I know this is an old topic, but I would like to add a small correction to @AdrianBrault's answer for anyone who stumbles upon this.

When installing the specified mini-library, you need to use the minifycsscompressor filter, which uses the MinifyCssCompressorFilter class. cssmin uses a different minimization library.

+1
source share

All Articles