---
title: "content.watch()"
description: "Keep the manifest and cache in sync with source file changes."
canonical_url: "https://content.comark.dev/reference/content/watch"
---
# content.watch()

> Keep the manifest and cache in sync with source file changes.

## `content.watch()`

Subscribes to every watchable source and keeps the manifest and cache in sync with file changes, firing the `watch:file:update` and `watch:file:remove` hooks after each change is applied.

**Parameters:** none.

**Returns:** `Promise<() => Promise<void>>`, an async stop function that unsubscribes the watcher.

```ts [usage.ts]
const stop = await content.watch()
// later:
await stop()
```

If processing a change fails (a parse error, or a validation error with `onError: 'throw'`), the entry is dropped from the manifest, the error is logged through the instance logger, and the `watch:error` hook fires. The watcher stays alive and keeps handling subsequent changes.

A source fires watch hooks only if its driver supports watching: the [`fs`](https://content.comark.dev/sources/filesystem) source watches via chokidar; [`github`](https://content.comark.dev/sources/github) does not. Reads still work either way.

## Usage

```ts [usage.ts]
const stop = await content.watch()
await stop()
```


## Sitemap

See the full [sitemap](https://content.comark.dev/sitemap.md) for all pages.
