> For the complete documentation index, see [llms.txt](https://hollow-peak.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hollow-peak.gitbook.io/docs/customisation/custom-css-and-javascript.md).

# Custom CSS & JavaScript

Changing the code, and surviving updates.

## Before writing any

Check whether a setting already does it. The theme editor covers colour, type, radii and background. A custom stylesheet that hard-codes a colour will fight the theme editor forever.

## Where the front-end lives

{% hint style="info" %}
Most of Hollow Peak's interface is **plain CSS and JavaScript** in `public/css` and `public/js`, with no build step. Vite handles only two things: the 3D viewer and the code showcase.

This is why customers do not need Node.js to install or run it.
{% endhint %}

| Path                               | Contents                  | Build needed |
| ---------------------------------- | ------------------------- | ------------ |
| `public/css/*.css`                 | Site and dashboard styles | No           |
| `public/js/*.js`                   | Interface behaviour       | No           |
| `resources/js/portfolio-viewer.js` | 3D viewer                 | Yes          |
| `resources/js/portfolio-code.js`   | Code highlighting         | Yes          |

## Adding your own CSS

The update-safe approach is a file of your own rather than editing a shipped one.

1. Create `public/css/custom.css`
2. Add it to the layout, after the existing stylesheets:

```blade
<link rel="stylesheet" href="{{ asset_v('css/custom.css') }}">
```

Use the theme's tokens so your CSS follows the theme:

```css
.my-panel {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: var(--card-radius);
}
```

### Per-block classes

Every page-builder block accepts a **custom class** under Layout. Style that class rather than guessing at structural selectors, which may change between versions.

## Asset versioning

`asset_v()` appends the file's modification time to its URL, so browsers fetch a changed file immediately and cache an unchanged one.

Use it rather than a hand-written version, which only works until somebody forgets to change it.

## Rebuilding Vite assets

Only if you edit `resources/js` or `resources/css`:

```bash
npm install
npm run build
```

Commit the resulting `public/build` output if you keep the project in version control.

## Editing Blade templates

Templates are in `resources/views`. After editing:

```bash
php artisan view:clear
```

{% hint style="warning" %}
**Editing shipped templates makes updating harder.** Every change you make is a change you may have to reapply.

Where possible, prefer a custom stylesheet, a custom class, or a new page-builder block over editing a core view.
{% endhint %}

## Adding a page-builder block

Two steps:

1. Add a definition to `App\Support\PageBlocks` — label, group, icon, fields
2. Create `resources/views/blocks/your-block.blade.php`

The registry drives the palette, the inspector and the sanitiser, so a new block gets all three without further work.

{% hint style="info" %}
The test suite includes a check that every Blade view compiles. Run `php artisan test` after adding a block — it catches a whole class of template error that otherwise appears only when somebody opens the page.
{% endhint %}

## Adding a payment provider

Implement `App\Payments\PaymentGateway`, register it in `PaymentRouter`, and add a settings panel. The interface defines exactly what a provider must do.

## Keeping a record

Whatever you change, write it down — which files, and why. Updating is far easier with a list than with a diff against a version you no longer have.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hollow-peak.gitbook.io/docs/customisation/custom-css-and-javascript.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
