I am trying to get CSS and JS minification set up in a Symfony project using assetic. I can not use java or node.js or anything like that, so I was following the directions at Symfony2 minify without java or node by userlond to get the filters in assetic that use minify to do it for me.
I followed the instructions and have installed minify via composer, but I keep getting the following when I do an assetic dump:
php.CRITICAL: Fatal Error: Class 'JSMinPlus' not found {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 0): Error: Class 'JSMinPlus' not found at /var/www/html/new_test_1/vendor/kriswallsmith/assetic/src/Assetic/Filter/JSMinPlusFilter.php:32)"}
[Symfony\Component\Debug\Exception\ClassNotFoundException]
Attempted to load class "JSMinPlus" from the global namespace.
Did you forget a "use" statement?
If I don't try use the jsminplus filter, but am still using the minifycsscompressor filter, it all seems to work fine (and I get my CSS minified).
Has something changed in the minify project that has created an incompatibility or something?
The code I am using in the TWIG template is:
{% javascripts
'@TemplateBundle/Resources/public/media/site-assets/javascript/vendor/jquery-1.12.1.min.js'
'@TemplateBundle/Resources/public/media/site-assets/javascript/vendor/*.js'
'@TemplateBundle/Resources/public/media/site-assets/javascript/*.js'
filter='jsminplus'
%}
<script src="{{ asset_url }}"></script>
{% endjavascripts %}
If I take out the filter='jsminplus' line, it all works fine (and is just not minified).