Skip to content

Instantly share code, notes, and snippets.

@jtdaad
Last active June 30, 2020 15:57
Show Gist options
  • Select an option

  • Save jtdaad/9ae2461db6356314150f739a47efd054 to your computer and use it in GitHub Desktop.

Select an option

Save jtdaad/9ae2461db6356314150f739a47efd054 to your computer and use it in GitHub Desktop.
Ghost blog templates local development setup

GHOST local development

ghost-blogs

For local development of templates for ghost blogs

getting setup the first time

  1. Use the Terminal to navigate to the directory you want to run your development in (I call mine "repos" and will use that name in these instructions)
  2. Create a directory in "repos" for your ghost templates, I recommend creating a Git repo for them
  3. Create a directory in "repos" called "ghost-server"
  4. run cd ghost-server
  5. run npm install ghost-cli@latest -g
    • if you get EACCESS errors run this sudo chown -R `whoami` ~/.npm then sudo chown -R `whoami` /usr/local/lib/node_modules
  6. then run ghost install local
    • If you get a "command not found" error, try closing the terminal, and try again on a new one
  7. run cd ../ to get back to your "repos" folder, then run pwd and copy the return
  8. In the terminal, navigate to the ../repos/ghost-server/content folder and delete themes from it
  9. run ln -s {pwd results}/ghost-blogs/themes {pwd results}/repos/ghost-server/content

Local development

  1. Follow the instructions at this link to install Ghost locally: https://docs.ghost.org/install/local/
  2. Always always always commit & push changes to gitub so there is a good record of changes.
  3. Local ghost is on localhost://2368 (plus /ghost for admin panel)

Detail description of what each getting started step is doing

  1. This just gets you navigated to the location you want to run things out of. Some people like this on the desktop, I like mine to have the shortest path name possible, because I use it a lot.
  • This directory is where your templates will live, you can have as many different templates as you would like here. This is where you will make changes to your templates.
  • This directory is just a server, once you get this setup you will just need to be in this directory to run ghost start to start the local development server
  • This step simply navigates you into the new server directory
  • This command installs the ghost cli, this is the groundwork you need before installing the server
    • if you have access errors, this command will make you an owner of the correct directories so that you can install as needed
  • This command installs the actual ghost server
    • You may need to close & re-open your terminal to pick up the install
  • This command returns the absolute path to the directory that contains both the "ghost-server" and the "ghost-templates" directories
  • This step removes the themes folder so it doesn't conflict with the next step
  • This command creates a symbolic link from the server to the templates folder. This

Additional notes

if you still get the error you may need to add ghost to your PATH

  • Open up Terminal.
  • Run the following command: sudo nano /etc/paths.
  • Enter your password, when prompted.
  • Go to the bottom of the file, and enter the path to
  • Hit control-x to quit.
  • Enter “Y” to save the modified buffer.
  • That's it! To test it, in new terminal window, type: echo $PATH.
  • Jump back to step 6 and re-run the ghost install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment