Macro

EmbedFileContent

macro EmbedFileContent(path: string, context: FreestandingMacroContext) -> ()

Namespace: Raven.Macros
Assembly: Raven.Macros.dll
Source file: EmbedFileContent.rvn

Embeds the UTF-8 text content of a file as a string literal.

Import Raven.Macros.* to invoke the conventional embedFileContent! alias. The canonical Raven.Macros.EmbedFileContent! spelling remains available when the alias is shadowed or the namespace is not imported.

Relative paths are resolved from the directory containing the Raven source file that invokes the macro. Compilation fails when the file does not exist or cannot be read. Cached expansions observe the file and are refreshed after it changes, is deleted, or is recreated.

Example

import Raven.Macros.*

let template = embedFileContent!("assets/template.html")