Answer the question
In order to leave comments, you need to log in
Yii2. How to minimize and merge files?
Hey!
The task of minimizing and gluing css, js arose. I wrote my own component responsible for minimizing and merging files. We got 2 files all=1453985904.js and all-1453985904.css, which must be included in your AssetBundle.
How can I do that? Naturally, timestamps like 1453985904 will sometimes change.
Answer the question
In order to leave comments, you need to log in
Minimization and gluing, as it were, should be done by Gulp or Grunt even before everything goes into production.
Here is 1 link from Google if you really want yii to do this.
yiiframework.ru/forum/viewtopic.php?t=19411
if you stop at your minification approach, you can substitute a file for AssetBundle on the fly by overriding init():
public function init()
{
parent::init();
$js = $this->js;
$js[] = 'js/cart.'.Yii::$app->language.'.js';
$this->js = $js;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question