1

I'm running Magento 2 in production mode.

I made some changes in my theme's css files.

I try to make the css change reflecting on the live site, by using following command.

php bin/magento setup:static-content:deploy en_AU en_US

I can't see the css files are updated in pub/static folder.

I have flushed cache php bin/magento cache:flush before and after static-content deploy.

Did i miss any steps?


Update,

By removing everything from the pub/static/frontend folder, then deploy static-content will make css changes reflecting on the site. But this will break site for a few moment. There's no way to implement css / js changes in a product mode without breaking the site?

10
  • Please try Flush Javascript/CSS cache from admin panel and then check. @xxx Mar 27, 2018 at 10:52
  • @DhadukMitesh Before I deploy, I ran this command magento cache:flush. I think this will remove all cache? Mar 27, 2018 at 11:02
  • 1
    First you execute php bin/magento setup:static-content:deploy. after that Flush Javascript/CSS cache from admin panel. Mar 27, 2018 at 11:04
  • Working or not? @xxx Mar 27, 2018 at 11:22
  • I tried to flush js/css cache i admin after static-content:deploy. The css files still not updated in pub/static/frontend folder. But if I remove everything from pub/static/frontend folder then deploy, it will work. but as I mentioned in the question, removing everything from pub/static will break my site for a few moment, which I want to avoid. Mar 27, 2018 at 11:23

1 Answer 1

-1

Run orders in the following order:

rm -Rf var/view_preprocessed/* var/*cache/* pub/static/frontend/*
php bin/magento setup:static-content:deploy
php bin/magento cache:flush --all

In production mode, you have a CSS and JS files cache, this cache is must remove after that is must refresh cache, screen.

7
  • If I remove everything from pub/static/frontend/* then my site will broke right? I know I can then deploy static-content right away, but I cant afford to have the site down for 1 or more minutes. Mar 27, 2018 at 10:39
  • yes, after remove, site is possible to down, but you must remove everything from var/view_preprocessed/
    – St3phan
    Mar 27, 2018 at 10:42
  • Run commands from answer
    – St3phan
    Mar 27, 2018 at 10:42
  • thanks, but then we can come to a conclusion that when running Magento 2 in production mode, there's no way to get css / js changes on live site without breaking the site for a few moment? Mar 27, 2018 at 10:45
  • 1
    this is command for clear all php bin/magento cache:flush --all, if not working, I recomand you to clear from admin and after that refresh to all caches.
    – St3phan
    Mar 27, 2018 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.