I'm trying to customize a theme with a child theme. When I add a new class in the css with background image it works like a charm in development both EN and FR (my 2 languages). I use the setup:static-content:deploy command in my production site to apply changes :
- EN : ok
- FR : images don't show in frontend
After many try, I check the /pub/static files : images are copied only in the EN folder (/pub/static/frontend/Vendor/theme/en_US/images). If I put directly the image in the fr_FR folder it works.
I'm probably missing something in my .phtml file to declare this in all languages available. Thanks for your help
-
Which Magento 2 version do you run?user5198077– user51980772018年01月06日 14:00:43 +00:00Commented Jan 6, 2018 at 14:00
-
Another question, what errors do you get in Chrome developer tools? 404s on the specific images - if so, the second reply in the answer below could be applicable.user5198077– user51980772018年01月06日 14:21:51 +00:00Commented Jan 6, 2018 at 14:21
2 Answers 2
I've faced two bugs that may be related. This is not really related to your hypothesis about missing something in the .phtml-file.
Static files are not generated for empty child themes. There must be one file in the web-folder. Workaround in short, put one file in the theme/web/images-directory and rerun setup:static-content:deploy.
Read more about it here, or at GitHub.
Bugs in static content deploy. This bug impacted CSS and language for translated sites for me. I deployed my second language first, and then a global language deploy, on the specified theme. Not in the same command.
Example:
php bin/magento setup:static-content:deploy --theme=Magento/luma en_US
php bin/magento setup:static-content:deploy --theme=Magento/luma nl_NL
php bin/magento setup:static-content:deploy --theme=Magento/luma fr_FR
Read more about it here at GitHub.
-
very interesting reading. that's probably why some of the terms in my child theme where not translated...cap340– cap3402018年01月07日 00:03:54 +00:00Commented Jan 7, 2018 at 0:03
Try :
php -f bin/magento setup:static-content:deploy fr_FR