Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static files fall back mechanism docs clarification #2609

Closed
Januszpl opened this issue Jul 25, 2018 · 5 comments
Closed

Static files fall back mechanism docs clarification #2609

Januszpl opened this issue Jul 25, 2018 · 5 comments
Assignees
Projects

Comments

@Januszpl
Copy link

Januszpl commented Jul 25, 2018

Topic clarification/correction request

Theme inheritance

Topic Link

https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/themes/theme-inherit.html

Description

There is issue with docs about overriding static files.

Section "If module context is not defined for a file" seems correct but if "module context is defined for a file" seem it doesn't work (path nr 1) for case like:

<img src="<?= $block->getViewFileUrl('Magento_Catalog::images/product/placeholder/thumbnail4.jpg') ?>" />

<img src="<?= $block->getViewFileUrl('images/product/placeholder/thumbnail4.jpg') ?>" />
<img src="<?= $block->getViewFileUrl('images/product/placeholder/thumbnail2.jpg') ?>" />

If module context is not defined for a file (second and third image above) it properly looks for file in those paths:
<theme_dir>/web/i18n/
<theme_dir>/web/

However if we use "Magento_Catalog::" then it doesn't check/get a file from nr 1 option but only from nr 2

  1. Current theme and current locale module static files:<theme_dir>/web/i18n//_
  2. Current theme module static files <theme_dir>/_/web/. Example: app/design/frontend/OrangeCorp/orange/Magento_Catalog/web/

It's not big deal as usually people won't put there a files (at least images - didn't check for other types) but it should be fixed/clarified how it works in documention as now it seems to be wrong for this case.

If module context is not defined for a file:

Current theme static files for a specific locale (the locale set for the storefront): <theme_dir>/web/i18n/
Current theme static files: <theme_dir>/web/
Ancestor’s static files, recursively, until a theme with no parent is reached:
<parent_theme_dir>/web/i18n/
<parent_theme_dir>/web/
Library static view files: lib/web/
If module context is defined for a file:

Current theme and current locale module static files:<theme_dir>/web/i18n//
Current theme module static files <theme_dir>/
/web/. Example: app/design/frontend/OrangeCorp/orange/Magento_Catalog/web/
Ancestor themes module static files, recursively, until a theme with no ancestor is reached:
<parent_theme_dir>/web/i18n//
<parent_theme_dir>/
/web/
Module static view files for the frontend area: <module_dir>/view/frontend/web/
Module static view files for the base area: <module_dir>/view/base/web/

Possible solutions

Remove option 1 for module context is known or update/clarify it.

Additional information

@debuysserk
Copy link
Contributor

What's the status on this item? Currently studying for front-end developer exam and was curious about the fallback with locales and like you, my tests showed option 1 for files with module context does NOT work. All the other options work alright.

Thanks for clarifyig the docs, or should M2 code be corrected?

@magento-engcom-team magento-engcom-team added this to Ready for Grooming in Backlog Jun 27, 2019
@okorshenko okorshenko moved this from Ready for Grooming to Ready for Development in Backlog Jun 27, 2019
@shrielenee
Copy link
Contributor

@bdenham Any news? 📰

@dshevtsov dshevtsov removed the Groomed label Aug 19, 2020
@Santoshziffity
Copy link
Contributor

@magento I am working on this

@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in Backlog Jan 29, 2021
@erikmarr
Copy link
Contributor

@Santoshziffity Are you still working on this?

@erikmarr erikmarr added the Waiting for Response Waiting for response from internal/external parties label May 12, 2021
@dobooth dobooth removed the Waiting for Response Waiting for response from internal/external parties label Jul 29, 2021
@dobooth dobooth moved this from Dev In Progress to Ready for Development in Backlog Jul 29, 2021
@m2-community-project m2-community-project bot moved this from Ready for Development to Dev In Progress in Backlog Jul 29, 2021
@m2-community-project m2-community-project bot moved this from Dev In Progress to Ready for Development in Backlog Jul 29, 2021
@BarnyShergold
Copy link
Contributor

This issue was dealt with and fixed in Feb 2021 by @Santoshziffity so is being closed

@m2-community-project m2-community-project bot moved this from Ready for Development to Done in Backlog Aug 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Backlog
  
Done
Development

No branches or pull requests

10 participants