openpatch / openpatch/hyperbook

snippet helper copyFile

Open
#991 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
73
Forks
14
Avg merge
1h 14m
Merged PRs (30d)
9

Description

Sometimes you may want to include an external file in your project. Currently, you can either encode the file as base64 using a snippet helper, or rely on a separate bash script that runs beforehand.

It would be helpful to introduce a new helper: copyFile. This helper would copy the specified file into the output directory, prefix the filename with a random string to avoid name clashes, and return the new path.

Here’s an example usage:

<img src="{{copyFile '../../../images/logo.png'}}" />

In some cases, you might want to copy a file as part of the build process without including its path in the rendered output. To support this use case, the helper could accept an optional silent=true flag:

{{copyFile '../../../docs/README.pdf' silent=true}}

This would copy the file to the output directory as usual, but return nothing to the template.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing base64 snippet helper and the code that writes files to the output directory. Implement the proposed copyFile behavior, including the random filename prefix and optional silent=true handling, then verify that the rendered path and silent copy match the examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.