Closed alansemenov closed 3 years ago
Simply drop the cache header (or perhaps Even force no caching)
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.
Disabling browser cache can be done easily via http cache headers
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.
To see how work in production, the developer can simply run XP without dev mode :-)
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.
To sum up
Better to document dev mode in our reference and mention browser checkbox there enonic/doc-xp#148
Hmm... Are you saying devs are familiar with disabling cache? I never heard about this before now?
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.
In dev
mode assets endpoint always has new fingerprint.
follow up task #8612
When XP is running in dev mode assetUrl should not be cached. Related issue: https://discuss.enonic.com/t/asseturl-should-not-generate-cache-headers-when-in-dev-mode/2209/7
in prod mode only assets with correct fingerprint and path should be cached