I’d like to modify the Starter theme and see the changes on my local ghost instance. Then push them into a production instance as well. Is that possible? I think the last step is possible with the Github Actions integration. But how about forking a theme and making that run on a local instance?
# Install
yarn
# Run build & watch for changes
yarn dev
And what it does is
$ gulp
[11:31:17] Using gulpfile ~/.../content/themes/cms-template/gulpfile.js
[11:31:17] Starting 'default'...
[11:31:17] Starting 'css'...
[11:31:17] Finished 'css' after 398 ms
[11:31:17] Starting 'js'...
[11:31:18] Finished 'js' after 1.35 s
[11:31:18] Starting 'serve'...
[11:31:18] Finished 'serve' after 1.85 ms
[11:31:18] Starting 'cssWatcher'...
[11:31:18] Starting 'hbsWatcher'...
But how shall I see the changes I made on my local instance? Do I have to clone the theme repo inside ../content/themes and run yarn dev there? I actually tried that and ended up with:
The Starter theme seems not yet compatible with Ghost 5.0; that’s why you have these activation errors. The errors come from the signup.hbs page. You will need to fix these errors or just delete that file if this is something you don’t want.
But it requires zipping the theme files and uploading it on Ghost admin panel. What I wanna do is to see the changes immediately on my local Ghost instance without uploading the zip
You have to be careful not to upload a copy of your theme, because it will overwrite your development copy, and you could lose unsaved work. I know this because I’ve done it more than once
To avoid this possibility, I’ve started symlinking from a projects directory to contet/themes. That way, the theme can’t be overwritten and is separate from the Ghost instance.
To do this, navigate to content/themes and run this command, which links your theme folder to the Ghost one:
ln -s ~/themes/theme-folder .
If you output the contents of the themes folder, you should now see symlinked version of your theme. Restart Ghost and the theme will be available for activation.