3

Enabling developer mode in magento is giving some errors for me, it is still trying to load all my static content. Ive disabled the "sign static content" option.

Also, when I put my Magento environment in production mode, the fonts in my design/frontend/vendor/theme/web/fonts folder are not moved to the static content.

Any thoughts?

3

When running in developer mode, files will still be loading from the pub/static folder. The difference is that some magic in the pub/static/.htaccess file routes the request to the pub/static.php file, which generates symlinks to populate the pub/static directories with your files, on demand. So, one possible way to fix developer mode is:

  1. If you are running Apache, make sure you didn't delete pub/static/.htaccess, and make sure Apache is configured to use .htaccess files.
  2. If you are running Nginx, make sure the site configuration is correct also. You can look at the nginx.conf.sample file for examples of how to set up the /static/ rewrite.

I'm not sure about what's going on with the fonts in production mode if running bin/magento setup:static-content:deploy isn't moving them.

Maybe try to clear all your caches, then run setup:static-content:deploy again:

  1. bin/magento cache:clean
  2. rm -r var/view_preprocessed/*
  3. rm -r var/page_cache/*
  4. rm -r pub/static/*
  • Hey thanks for replying. I replaced the .htaccess with another one, and developer mode works like it should again, which is weird since I've never made any changes to it. As for the fonts, they are being generated to pub/static/frontend/vendor/theme/nl_NL/fonts, instead of pub/static/frontend/vendor/theme/web. Do you know what could be the cause of this? – perrivdb Jun 6 '17 at 7:40
  • @perrivdb That path, pub/static/frontend/vendor/theme/nl_NL/fonts, looks correct. The deploy methods publish everything in the app/design/frontend/vendor/theme/web directory to the pub/static/frontend/vendor/theme/local_CODE directory (where local_CODE is nl_NL in this case). For instance app/design/frontend/vendor/theme/web/images/logo.jpg is published to pub/static/frontend/vendor/theme/nl_NL/images/logo.jpg, etc. This is where M2 expects them, so methods like $block->getViewFileUrl('images/logo.jpg') work. – thaddeusmt Jun 6 '17 at 21:11
  • Then why does my Magento installation look for the fonts in the 'pub/static/frontend/vendor/theme/web/fonts' folder? – perrivdb Jun 7 '17 at 14:10
  • Where are those font paths being requested from? A style sheet I assume? Which one? – thaddeusmt Jun 7 '17 at 14:45
  • 1
    Found the problem! Font paths in my .scss stylesheet were directing to the font directory in app/design, not taking into account what path they would be inside the pub/static folder. Solution was to fix the font path in my scss stylesheets. Thanks for the help! – perrivdb Jun 8 '17 at 6:44

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.