/ ghost

Running Ghost as an npm module

Starting with the most recent release, 0.4.2, Ghost is now published as an npm module. I found the upgrade instructions to be rather horrifying and it just makes sense to abstract away Ghost core. There isn't a reason to modify core, just like WordPress. There is a wiki page for running ghost as an npm module but, they don't include everything that is needed.

I'm starting with the assumption that you have your Ghost site in git already.

  • Delete everything in you the sites folder except config.js and your content directory.
  • Add a package.json file:
{
  "name": "blog name",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node app.js"
  },
  "dependencies": {
    "ghost": "^0.4.2"
  }
}
  • Modify your config.js file to add to add a paths section like:
paths: {
  contentPath: path.join(__dirname, '/content/')
}

To both the development and production sections

  • Add an app.js file:
var ghost = require('ghost');
var path = require('path');
ghost({
  config: path.join(__dirname, 'config.js')
});
  • Install the dependencies by running npm install --production
  • Restart/Redeploy your blog and enjoy running Ghost as an npm module