enonic / xp

Enonic XP
https://enonic.com
GNU General Public License v3.0
201 stars 34 forks source link

Improve assets cache #8117

Closed alansemenov closed 3 years ago

alansemenov commented 4 years ago
sigdestad commented 4 years ago

Simply drop the cache header (or perhaps Even force no caching)

poi33 commented 4 years ago

This is a built in feature on all browsers, disable-caching of assets. Even if we remove the caching headers the browser can still force caching. I cant find any development environment that forces the browser to not cache, it is usually a flag or an option to add custom header data.

I suggest to add documentation that the developer needs to disable the cache in the browser.

sigdestad commented 4 years ago

Disabling browser cache can be done easily via http cache headers

rymsha commented 4 years ago

Unfortunately, not @sigdestad Browsers are "smart" and like to cache anyway. https://blog.chromium.org/2017/01/reload-reloaded-faster-and-leaner-page_26.html

I am also not sure developers will be happy to see noticeable performance drop for page loading (not cached .js and .css files must be always parsed and executed). Even when development mode tis turned on "because it is always turned on on developer's machine". It is certainly a trade-off: one bad experience against another bad experience.

None of frameworks I know change cache-control headers for "static" files in development mode. Because disabling cache in browser is a way more flexible approach.

sigdestad commented 4 years ago

To see how work in production, the developer can simply run XP without dev mode :-)

rymsha commented 4 years ago

To see how work in production, the developer can simply run XP without dev mode :-)

But I don't see how it is better than toggle checkbox in the browser. IMO toggle checkbox in browser is simpler as developer does not need to stop XP instance, change mode and start instance again.

rymsha commented 4 years ago

To sum up

Better to document dev mode in our reference and mention browser checkbox there enonic/doc-xp#148

sigdestad commented 4 years ago

Hmm... Are you saying devs are familiar with disabling cache? I never heard about this before now?

poi33 commented 4 years ago

Hard refreshing is one of the first thing i teach to new developers. Beacause one of the first issues with css is that it does not update.

rymsha commented 4 years ago

https://stackoverflow.com/questions/5690269/disabling-chrome-cache-for-website-development

rymsha commented 3 years ago

In dev mode assets endpoint always has new fingerprint.

follow up task #8612