Answer the question
In order to leave comments, you need to log in
How to minify views before rendering in Yii2?
My task is to optimize the site on Yii2 as much as possible, in particular, I need to minify the html code in views, just before rendering. So far I have found this thing: searchturbine.com/php/phpwee (github repository: https://github.com/searchturbine/phpwee-php-minifier , application video: www.youtube.com/watch?v=t5t-r0N9Gzo ). How to make friends with this minifier with Yii2? Is it possible to make minification of html with regular framework tools?
Answer the question
In order to leave comments, you need to log in
You can try to use Spaceless https://github.com/yiisoft/yii2/blob/master/framew...
But it's better to stick to the Application::EVENT_AFTER_REQUEST event and reap all the HTML there
In my opinion, first you need to optimize the database, then queries to the database, then scripts, then remove all logic from the view and leave only the markup. Then what can be made a widget, make a widget. Then see how it all quickly worked and not have a brain for optimizing markup.
Minifying html by putting it in one line is saving on matches IMHO and this is a really dubious gain. Better use css/js minification and compression (etc), image size (weight) optimization, reduce site connection costs (spdy, gzip, ssl - caching) and just caching.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question