You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
--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
38
37
--target, -t comma separated target strings for esbuild
39
38
--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
41
43
--help, -h show help
42
44
--version, -v show version information
43
-
top-bun (v7.0.0)
45
+
top-bun (v10.5.1)
44
46
```
45
47
46
48
`top-bun` builds a `src` directory into a `dest` directory (default: `public`).
47
49
`top-bun` is also aliased to a `tb` bin.
48
50
49
51
- 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.
51
54
52
55
`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.
53
56
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
600
603
601
604
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.
602
605
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
+
603
622
### `--copy` directories
604
623
605
624
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