3

Whenever I make changes css or anything I have to ask the client to clear cache to view the changes same for me.

Any advise on how to deal with this.

Magento 2.

Shoaib Munir
9,59210 gold badges54 silver badges109 bronze badges
asked Nov 22, 2017 at 12:59
1
  • remove cache and page cache folders from var directory. Commented Nov 22, 2017 at 13:04

2 Answers 2

1

You could try using versioning for css and js.

This option can be enabled in the:

`Stores` ->
 `Configuration` ->
 `Advanced` ->
 `Developer` ->
 `Static Files Settings` ->
 `Sign Static Files` ->
 `Yes`

This option adds a timestamp to js and css files and it allows to invalidate cache in the client's browser.

After enabling this option and flushing cache from admin panel or CLI, your files will look like:

domain.name/pub/static/version1511443406/frontend/Magento/luma/en_US/css/print.css

instead of

domain.name/pub/static/frontend/Magento/luma/en_US/css/print.css

So the difference in the version1511443406 part.

answered Nov 23, 2017 at 13:30
0

This is not a real solution but can be something helpful for you. The change which you are doing in your CSS, you will need to do the same change in pub/...css file. Because this is the file which actually gets rendered.

Not Sure if this will actually solve your problem, but will possibly be a way out to your issue.

answered Nov 22, 2017 at 13:01
4
  • but isnt the issue the client browser's cache? coz we are in production mode the static files should update I guess or I might be wrong. Commented Nov 22, 2017 at 13:25
  • The way to check that is to track if the client see your css changes in view source? And is the pub file getting deployed has your changes Commented Nov 22, 2017 at 13:28
  • aha ok will try to ask customers... I wonder how big companies handle that... there must be some kind of mod expiration on cache or something Commented Nov 22, 2017 at 13:32
  • You can check that in a different machine with different location Commented Nov 22, 2017 at 13:49

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.