I just got through getting the minification to work (How do I combine & minify JS and CSS for a Yii app on Heroku?) locally. However, it creates the all-1bc649be34b1e6afc9b2419687cde016.js
file under web/assets/
. Yii creates a .gitignore
to ignore everything in that directory. None of the files will make it to Heroku. Even if I use heroku run yii asset assets.php config/assets-prod.php
it will only create ephemeral files that are not accessible to the web dynos. (As suspected it does fail in production. The CSS is not there!) How does minification work with Heroku? What happens if I change a file? Do I have to manually run the assets
command again? Is there a way to make it automatic?
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
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 addedand 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 theyii
command to run on Heroku, because it gives an error about Gii.