Ghost: Hot-reload of themes

Created on 10 Nov 2013  路  9Comments  路  Source: TryGhost/Ghost

Ghost should hot-reload themes to eliminate the necessity of restarting it in order to see a new theme. I am not aware of the technical restraints of the templating engine used, so I won't PR on this. Comments on hot-reloading?

server / core themes / frontend

All 9 comments

The reason this has not yet been put forward as an issue, is deciding when and how to do this. At the moment it is done specifically at app start.

I think the first step would be to introduce a reload button. It's certainly not something I think should ever be done on every request. In fact I'm not sure that anything more than a reload button is actually necessary.

Rather than reloading the whole thing, it could have a 'check for new themes' button or even just a simple reload icon next to the theme selector.

A reload button next to the theme selector sounds to me like the best solution.

We could also use a file system watcher solution, though I suppose it'd be a bit of an overkill.

Would it be possible to just read the themes when the settings page is loaded?

@sirlancelot not currently, we'd need an API endpoint to do this and that has a bunch of other prerequisites including permissions, file storage abstraction etc. Improving theme management in Ghost is something we're working towards though.

A public API endpoint to reload the current theme would be really useful. Is it on the roadmap?

No public API endpoint is on the roadmap at present. There is already a private API endpoint for uploading a theme which does go through all of the necessary cache invalidation etc (and is being refactored heavily in the current alpha) so that's usable if you are running in production.

When developing a theme it's suggested to run ghost locally in development mode where changes to theme files are picked up automatically.

This issue is ancient, officially the oldest issue on our repository.

In Ghost 1.0, we've overhauled how themes behave. We now have the theme uploader. In addition we have ghost install local and a section in the docs, which explains an easy way to setup reloads for theme development here: https://docs.ghost.org/v1.0.0/docs/install-local#section-developing-themes.

Given the way Ghost themes work, even with the refactoring, I don't think it's worth the additional complexity and overhead to get hot reloading working. The best we were ever going to get was a reload button.

I'm going to close this issue, and hope that the tools we now have are sufficient.

I'd be super interested in any contributions that make it easy for local installs to also have livereload or other useful tools, but I think most people add build pipelines etc to their themes directly.

Was this page helpful?
0 / 5 - 0 ratings