Issues That May Come Up When Changing A Ghost Theme

SITUATION

When changing a theme or when editing theme files you will not always see the changes immediately. This has to do with how the Ghost works. Below are some answers on how to deal with this situation

SELF-HOSTED GHOST BLOGS

WHEN CHANGING A THEME - RESTART GHOST !

In production mode, the template files are loaded and cached by the server ready to send to the browser. This means that if you add a new theme OR just make changes to a theme, e.g. change a *.hbs file, you won't see those changes reflected UNLESS YOU RESTART GHOST. This doesn't happen in development mode, and so pages will take a little longer to get generated, but it makes creating your theme much easier.

This includes editing and making a change to any theme file (e.g. .css, .js, .hbs file)

HOW TO RESTART GHOST

service 'name-of-blog' restart

where 'name-of-blog' is the name, WITHOUT the quotation marks, of your startup script in /etc/init directory. (usually it is just 'ghost')

Running this command usually does the trick and should enable you to see your changes.

RUNNING GHOST IN DEVELOPMENT MODE TO SEE CHANGES IMMEDIATELY

When you develop a theme it is tiring to have to go through each step above. Not to worry, the Ghost folk's have you covered. You can put Ghost in Development mode and then you can work on a theme and see changes immediately. That is done the following way:

Provided that you have remembered to set your config.js properly you can start Ghost in development mode, when inside the Ghost folder, by running this command

npm start

CAVEAT

Ghost won't detect new files automatically, but it will pick up changes to those files once it knows about them (providing you're in development mode). Remember to restart Ghost if you add a new .hbs file. Apart from this, you'll only need to refresh the page to see your changes.

So basically, while edits to existing handlebars, js and css files are handled & updated on the fly when in development mode, you will need to restart Ghost each time you add or remove a file from the theme directory for it to be recognized and used.

UPDATE

Starting with Ghost 0.9 there is a new theme manager that is pretty cool and that allows you to upload zipped themes the same way Ghost(Pro) users do. Thanks to this new theme upload manager, you no longer need to restart Ghost each time you make a change. Just upload the theme, click 'activate' and the theme gets implemented immediately. See screenshot

GHOST(Pro) BLOGS

Just upload your theme as a zipped file and it will be detected automatically by Ghost. Once it is uploaded, click on either Activate now to activate the theme immediately or Close if you want to activate it later on.

No need to re-start Ghost

CAVEAT

Sometimes, (very very seldom), I have noticed this auto-detection is not happening or weird things occur with the theme. DON'T PANIC!

Usually it is the Ghost folk's that are rolling out a major theme update and that may affect the hosted customer systems. Just wait a few hours and the issues usually disappear. If you can't wait send an email to support@ghost.org

Reference Links:

http://themes.ghost.org

https://www.ghostforbeginners.com/how-to-install-a-ghost-theme

https://www.ghostforbeginners.com/how-to-configure-ghost-to-run-in-either-development-or-production