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?

4 Answers 4

1

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

3
  • It don't has .htaccess
    – AndresF
    Commented Dec 22, 2016 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
    Commented Dec 22, 2016 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
    Commented Dec 22, 2016 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
1
  • Yes I run the command to my locale. The probem was .htaccess. Vlad Patru resolve my dubt
    – AndresF
    Commented Dec 22, 2016 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
2
  • I do this but It's the same. It not load CSS good
    – AndresF
    Commented Dec 22, 2016 at 9:01
  • Please refer to this link Commented Dec 22, 2016 at 9:08
0

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

3
  • But if I do a change in xml file, I nedd run php bin/magentosetup:upgrade
    – AndresF
    Commented Dec 22, 2016 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. Commented Dec 22, 2016 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. Commented Dec 22, 2016 at 9:21

Your Answer

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

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