When trying to develop a theme locally, assets are cached even when Ghost is running in development - making it very hard to work with / need to force refresh every time. Not sure if I'm doing something wrong here, or if it's a bug. I feel like it's the latter but I'm not 100%.
Expected: Shit to change
Actual: No change. Version string seems to be added: /assets/public/screen.css?v=5107093647 -- which means a force refresh is required to get the browser to load it again
Will this change be enough?
https://github.com/TryGhost/Ghost/blob/master/core/server/middleware/static-theme.js#L25
// Replace
{maxAge: utils.ONE_YEAR_MS}
// With
{maxAge: config.get('env') === 'production' ? utils.ONE_YEAR_MS : 0}
Might need change in cache middleware (https://github.com/TryGhost/Ghost/blob/master/core/server/middleware/cache-control.js) as well...
EDIT: Github allows people to "thumbs up" their own comment.....weird.
@vivekannan This fix looks good. If you could PR your suggestion, that would be great.
It might be better to check config.get('env') === 'development ? 0 : utils.ONE_YEAR_MS, because people could also run a staging system.
Should we cache during testing as well?
On Tue, Jan 10, 2017 at 5:09 AM, Katharina Irrgang <[email protected]
wrote:
@vivekannan https://github.com/vivekannan This fix looks good. If you
could PR your suggestion, that would be great.It might be better to check config.get('env') === 'development ? 0 :
utils.ONE_YEAR_MS, because people could also run a staging system.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/TryGhost/Ghost/issues/7812#issuecomment-271442911,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHkl-ocnHHFAFo5vJhlU9YnsKjj282rsks5rQsU0gaJpZM4LYfav
.
Also, I am assuming that if there is an active theme available, the
cache-control middleware is never hit? When is the cache-control middleware
hit, generally speaking?
On Tue, Jan 10, 2017 at 12:18 PM, Vivek Kannan vivek7641@gmail.com wrote:
Should we cache during testing as well?
On Tue, Jan 10, 2017 at 5:09 AM, Katharina Irrgang <
[email protected]> wrote:@vivekannan https://github.com/vivekannan This fix looks good. If you
could PR your suggestion, that would be great.It might be better to check config.get('env') === 'development ? 0 :
utils.ONE_YEAR_MS, because people could also run a staging system.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/TryGhost/Ghost/issues/7812#issuecomment-271442911,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AHkl-ocnHHFAFo5vJhlU9YnsKjj282rsks5rQsU0gaJpZM4LYfav
.
Should we cache during testing as well?
No.
Also, I am assuming that if there is an active theme available, the
cache-control middleware is never hit? When is the cache-control middleware
hit, generally speaking?
Cache control middleware is always hit and it adds a cache control header with max-age=0 in case of public requests.
Fixed in master branch. Issue stays open, because we need this fix in LTS branch as well.
Will be released in 0.11.5. Closing.
Most helpful comment
Will be released in
0.11.5. Closing.