Can someone explain how Yii minimizing assets is supposed to work on Heroku?

风格不统一 提交于 2019-12-08 02:44:26

Ok I found this gem in Heroku docs. https://devcenter.heroku.com/articles/php-support#custom-compile-step. Turns out there is a way to specify a command in Composer's composer.json to run during the slug compilation. So I added

"scripts": {
    "compile": "php yii asset assets.php config/assets-prod.php"

and deployed and it generated the minified assets automatically! Whew! This f----- took like 10 hours to get working - way more than it should have!

Oh I should probably mention I had to hack config/console.php also to get the yii command to run on Heroku, because it gives an error about Gii.

'bootstrap' => YII_ENV == 'dev' ? ['log', 'gii'] : ['log'],
'modules' => YII_ENV == 'dev' ? [
  'gii' => 'yii\gii\Module'
] : [],
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!