What are the Slack Archives?
It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hi together. I made some changes to our frontend and after that I was running "npm run yves:producti
Hi together. I made some changes to our frontend and after that I was running "npm run yves:production". Now I have the problem that many users have problems with the site. Since the problem can always be solved by deleting their browser cache, I am wondering if there is a method to invalidate client caches on the server side. What is the best practice here?
I am no web developer and therefore I am a bit clueless here. I already tried the following
• restarting fpm
• disabling opcache
• console cache:empty-all
• console twig:cache:warmer
• restarting nginx
Comments
-
Hi Christian, I believe this PR https://github.com/spryker-shop/suite/pull/548 was aimed to solve exactly this issue.
AFAIK specifically"path": "assets/%SPRYKER_BUILD_HASH%/%theme%",
change.0 -
Hi @valerii.trots, thanks for your fast reply. I tried to configure path as you suggested (adding "%SPRYKER_BUILD_HASH%"). But after running npm run yves:production, the assets are placed to assets/%SPRYKER_BUILD_HASH%/...
The variable is not resolved.
0 -
Do you run it locally?
Docker? What is the tag for docker-sdk?0 -
I have tested it with docker. I am not sure what you mean by "tag". I am using the deploy.dev.yml (docker/sdk boot). And I have tested the configuration by runinng "npm run yves:production" with "docker/sdk cli" after launching everything with "docker/sdk reset"
0 -
Tag is the git's terminology. Are you on the latest master of
spryker/docker-sdk
or you cloned specific release version\tag?0 -
ah ok. I do not know since I added the sdk not as a git submodule to the project. But I will repeat the test with the latest docker/sdk version
0 -
If you are going to experiment anyway, could you please try to clone and install latest demoshop and latest spryker/docker-sdk and try it there? 🙂
Basically I'm not sure what exact changes have to be done from that PR but it should have solved the problem.0 -
Here the results of my tests with the latest b2b demo shop version and the latest sdk version:
After running "npm run yves:production" with "docker/sdk cli" all assets are put to "assets/current/default/DE/..."
The variable SPRYKER_BUILD_HASH always seems to be set to "current". With regard to with the outdated browser cache this would not help since the path is not changed and therefore the client would use its outdated cache instead of loading the new files.
Or do I understand this the wrong way?
0 -
I would ask @UN6T8SEM7 here.
0 -
do you have this line in the config?
$config[ShopUiConstants::YVES_ASSETS_URL_PATTERN] = '/assets/' . (getenv('SPRYKER_BUILD_HASH') ?: 'current') . '/%theme%/';
if yes,
try to set
export SPRYKER_BUILD_HASH=any-string-for-assets
then runnpm run yves:production
in Yves check that folder for .js/.css is changed to
any-string-for-assets
But I don't know how to set it for all docker services
0 -
This Problem is known and only solution now is to extend the publicPath Twig function and add as suffix the filemtime for the requested css or js.. In this case u are sure that the browser cache is automatically invalidate when the filemtime changed after a new
npm run yves:production
Of course, and i am sure, that exists some other better solution, but at the moment is the unique fast solution that i found last year....
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 75 Spryker News
- 921 Developer Corner
- 781 Spryker Development
- 88 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 34 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 25 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random