3

My Magento 2 not load CSS in frontend.

If I do php bin/magento setup:static-content:deploy, the problem is solved and load perfectly, but when I do setup:upgrade, CSS not load again.

I know that setup:upgrade remove the content generated to CSS.

Why?

1

I had the same issue, check your MAGENTO_ROOT/pub/static if it has the .htaccess file

  • It don't has .htaccess – AndresF Dec 22 '16 at 9:00
  • That is the issue, try to search on google for the pub/static/.htaccess or upgrade your magento2 version if is not the latest – Vlad Patru Dec 22 '16 at 9:03
  • Thank you very much. I create the directory and run deploy to load css and if I change xml file and I run setup:upgrade, CSS is load. Thanks – AndresF Dec 22 '16 at 9:32
1

Also deploy the static content of your frontend locale.

php bin/magentosetup:upgrade
php bin/magento setup:static-content:deploy
php bin/magento setup:static-content:deploy en_GB
  • Yes I run the command to my locale. The probem was .htaccess. Vlad Patru resolve my dubt – AndresF Dec 22 '16 at 9:33
0

First remove the file from pub/static folder and then run these commands:

php bin/magento setup:static-content:deploy
php bin/magentosetup:upgrade
0

Whenever you run php bin/magentosetup:upgrade command after that you have to run php bin/magento setup:static-content:deploy command.

  • But if I do a change in xml file, I nedd run php bin/magentosetup:upgrade – AndresF Dec 22 '16 at 9:02
  • No you don't have to run php bin/magento setup:upgrade after changes in xml files, you just have to run php bin/magento cache:clean if changes are not display. – Dipesh Rangani Dec 22 '16 at 9:08
  • @DipeshRangani you don't need to run bin/magento setup:static-content:deploy after a setup upgrade, when you're in development mode. – André Ferraz Dec 22 '16 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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