Skip to content

snippet helper copyFile #991

Description

@mikebarkmin

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions