I've set magento 2.2.2 on production mode.
I have a custom theme with a custom css main.css:
Now when I do changes to css file when magento in production mode it doesn't add straight away because it;s not symlink as developer mode.
then I go ahead and do: php bin/magento setup:static-content:deploy en_GB -t MYTHEME/default
php bin/magento cache:clean
and changes are not there.
What am I missing?
Thanks.
3 Answers 3
Use the grunt or gulp instead of doing all the commands every time. It works well for me.
Could you please try to run below commands :
php bin/magento setup:static-content:deploy
php bin/magento setup:static-content:deploy -f --area=frontend
php bin/magento set:upg
php bin/magento cache:clean
php bin/magento cache:flush
- 
 I've tried your suggestion but I need send my theme language also if i run only php bin/magento setup:static-content:deploy it only send en_US I need en_GB so I've run. php bin/magento setup:static-content:deploy en_GB -f --area=frontend then php bin/magento set:upg php bin/magento cache:clean php bin/magento cache:flush when I looad the frontend all the css is broken I have to refresh the page quite a few times to get the it kick in properly.Juliano Vargas– Juliano Vargas2018年04月27日 08:48:46 +00:00Commented Apr 27, 2018 at 8:48
- 
 where have you define your main.css? can you please share with me your website urlHitesh Koshti– Hitesh Koshti2018年04月27日 08:53:03 +00:00Commented Apr 27, 2018 at 8:53
- 
 I am on local dev server! Thanks for your help!Juliano Vargas– Juliano Vargas2018年04月27日 09:16:58 +00:00Commented Apr 27, 2018 at 9:16
I've found the following works in production mode I've done numerous time and it seems to do the job well.
First: Do the css changes then run in order
1- php bin/magento setup:upgrade
2- php bin/magento setup:static-content:deploy en_US --area=adminhtml en_GB -f --area=frontend
3- php bin/magento cache:clean
4- php bin/magento cache:flush
5- Also clean once backend cache too
Very important Clean browser cache! This is unfortunate because the user will not see the changes if their cache doesn't get clear.
UPDATE! if the a user hits the url website for the first after upg command or while is running:
And before all of the other one happens then css and much more stuff as require.js will be cached and that is a disaster unless the user clean their browser cache it be ugly. hummm.
Thank you!
Explore related questions
See similar questions with these tags.