openpatch / openpatch/hyperbook
snippet helper copyFile
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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