# ghost-trap

> Static site generator for the Ghost blogging platform.

Latest version **0.1.0** (published 2015-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install ghost-trap
pnpm add ghost-trap
yarn add ghost-trap
bun add ghost-trap
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2015-09-01 |
| First published | 2015-09-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Craig Ruks |
| Maintainers | craigruks |
| Keywords | ghost, blog, static, site, generator, trap |

## Links

- npm: https://www.npmjs.com/package/ghost-trap
- Repository: https://github.com/craigruks/ghost-trap
- Homepage: http://github.com/craigruks/ghost-trap
- Issues: https://github.com/craigruks/ghost-trap/issues
- npm.io page: https://npm.io/package/ghost-trap

## Dependencies (9)

- [url](https://npm.io/package/url.md) ^0.11.0
- [path](https://npm.io/package/path.md) ^0.11.14
- [node-fs](https://npm.io/package/node-fs.md) ^0.1.7
- [replace](https://npm.io/package/replace.md) ^0.3.0
- [sprintf](https://npm.io/package/sprintf.md) ^0.1.5
- [cli-spinner](https://npm.io/package/cli-spinner.md) ^0.2.1
- [finalhandler](https://npm.io/package/finalhandler.md) ^0.4.0
- [serve-static](https://npm.io/package/serve-static.md) ^1.10.0
- [simplecrawler](https://npm.io/package/simplecrawler.md) ^0.5.2

## Alternatives

- [@sveltejs/kit](https://npm.io/package/@sveltejs/kit.md) — 2.2M weekly downloads
- [@atlaskit/theme](https://npm.io/package/@atlaskit/theme.md) — 402.0K weekly downloads
- [@tangle-network/brand](https://npm.io/package/@tangle-network/brand.md) — 10.0K weekly downloads
- [seneca](https://npm.io/package/seneca.md) — 7.4K weekly downloads
- [@bsb/base](https://npm.io/package/@bsb/base.md) — 7.2K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2015-09-01

## README

# ghost-trap [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage percentage][coveralls-image]][coveralls-url]
> Static site generator for the Ghost blogging platform.


## Install

```sh
$ npm install --save ghost-trap
```


## Usage

```js
var ghostTrap = require('ghost-trap');

ghostTrap('localhost', '2368', './build-folder', 'yourdomain.com');
```

### Methods
#### .trap(ghostDomain, ghostPort, staticDirectory, staticWebAddress, [callback], [debug])

Generates a static site from `http://[ghostDomain]:[ghostPort]/` and places it in `staticDirectory` (relative to where you ran the command). You must add `staticWebAddress` as the command also replaces any instance of 'localhost:2368' in the static site to the value of `staticWebAddress` (as Ghost, when run locally, has references to that address).

**Takes:**
- {String} (required) Domain that the ghost instance is running on (usually `localhost`).
- {String} (required) Port that the ghost instance is running on (usually 2368).
- {String} (required) The directory you want the static site built in, relative to the folder where this method is run.
- {String} (required) The web address that replaces the instances ghostDomain in the static build
- {Function} (optional) A callback is made whenever a fetch fails or when the crawl is complete, should listen to it!
- {Function} (optional) This method will be called with verbose information whenever something happens of importance

**Returns:** null

#### .runStaticSite(staticDirectory, staticPort)

Runs the newly made static site from `staticDirectory` on localhost:`staticPort`. This is so you can check that the static site rendered correctly.

**Takes:**
- {String} (required) The directory you want the static site built in, relative to the folder where this method is run.
- {String} (required) Port that the static site should run from.
- {Function} (optional) This method will be called with verbose information whenever something happens of importance

**Returns:**
- {Object} The HTTP server instance. You can run server.close() to stop the service, or hit ctrl+c to exit if on command line.



## Tests
```sh
$ npm run test
```


## Motivation

I love using the Ghost blogging engine. Ideally I wanted to run Ghost locally and host as a static site. This module crawls a locally running Ghost instance and generates a static site.


## Contributors

Please contribute. Add issues, send pull requests, the works.


## License

MIT © [Craig Ruks](craigruks.com)


[npm-image]: https://badge.fury.io/js/ghost-trap.svg
[npm-url]: https://npmjs.org/package/ghost-trap
[travis-image]: https://travis-ci.org/craigruks/ghost-trap.svg?branch=master
[travis-url]: https://travis-ci.org/craigruks/ghost-trap
[daviddm-image]: https://david-dm.org/craigruks/ghost-trap.svg?theme=shields.io
[daviddm-url]: https://david-dm.org/craigruks/ghost-trap
[coveralls-image]: https://coveralls.io/repos/craigruks/ghost-trap/badge.svg?branch=master&service=github
[coveralls-url]: https://coveralls.io/r/craigruks/ghost-trap

---
_Source: https://npm.io/package/ghost-trap · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
