Skip to content

Commit e7bf161

Browse files
committed
Update docs
1 parent 5d47489 commit e7bf161

File tree

1 file changed

+23
-4
lines changed

1 file changed

+23
-4
lines changed

README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,23 @@ Usage: top-bun [options]
3434
--dest, -d path to build destination directory (default: "public")
3535
--ignore, -i comma separated gitignore style ignore string
3636
--drafts Build draft pages with the `.draft.{md,js,html}` page suffix.
37-
--copy Path to directories to copy into dist; can be used multiple times
3837
--target, -t comma separated target strings for esbuild
3938
--noEsbuildMeta skip writing the esbuild metafile to disk
40-
--watch-only watch and build the src directory without serving
39+
--eject, -e eject the top bun default layout, style and client into the src flag directory
40+
--watch, -w build, watch and serve the site build
41+
--watch-only watch and build the src folder without serving
42+
--copy path to directories to copy into dist; can be used multiple times
4143
--help, -h show help
4244
--version, -v show version information
43-
top-bun (v7.0.0)
45+
top-bun (v10.5.1)
4446
```
4547

4648
`top-bun` builds a `src` directory into a `dest` directory (default: `public`).
4749
`top-bun` is also aliased to a `tb` bin.
4850

4951
- Running `top-bun` will result in a `build` by default.
50-
- Running `top-bun --watch` will build the site and start an auto-reloading development web-server that watches for changes.
52+
- Running `top-bun --watch` or `top-bun -w` will build the site and start an auto-reloading development web-server that watches for changes.
53+
- Running `top-bun --eject` or `top-bun -e` will extract the default layout, global styles, and client-side JavaScript into your source directory and add the necessary dependencies to your package.json.
5154

5255
`top-bun` is primarily a unix `bin` written for the [Node.js](https://nodejs.org) runtime that is intended to be installed from `npm` as a `devDependency` inside a `package.json` committed to a `git` repository.
5356
It can be used outside of this context, but it works best within it.
@@ -600,6 +603,22 @@ These imports will include the `root.layout.js` layout assets into the `blog.lay
600603

601604
All static assets in the `src` directory are copied 1:1 to the `public` directory. Any file in the `src` directory that doesn't end in `.js`, `.css`, `.html`, or `.md` is copied to the `dest` directory.
602605

606+
### `--eject` flag
607+
608+
The `--eject` (or `-e`) flag extracts top-bun's default layout, global CSS, and client-side JavaScript into your source directory. This allows you to fully customize these files while maintaining the same functionality.
609+
610+
When you run `top-bun --eject`, it will:
611+
612+
1. Create a default root layout file at `layouts/root.layout.js` (or `.mjs` depending on your package.json type)
613+
2. Create a default global CSS file at `globals/global.css`
614+
3. Create a default client-side JavaScript file at `globals/global.client.js` (or `.mjs`)
615+
4. Add the necessary dependencies to your package.json:
616+
- mine.css
617+
- uhtml-isomorphic
618+
- highlight.js
619+
620+
This is useful when you want to heavily customize the default theme or behavior while still leveraging top-bun's core functionality.
621+
603622
### `--copy` directories
604623

605624
You can specify directories to copy into your `dest` directory using the `--copy` flag. Everything in those directories will be copied as-is into the destination, including js, css, html and markdown, preserving the internal directory structure. Conflicting files are not detected or reported and will cause undefined behavior.

0 commit comments

Comments
 (0)