Macro deno_core::include_js_files
source · macro_rules! include_js_files { ($name:ident dir $dir:literal, $($file:literal,)+) => { ... }; ($name:ident $($file:literal,)+) => { ... }; }
Expand description
Helps embed JS files in an extension. Returns a vector of
ExtensionFileSource
, that represent the filename and source code. All
specified files are rewritten into “ext:<extension_name>/<file_name>”.
An optional “dir” option can be specified to prefix all files with a directory name.
Example (for “my_extension”):
ⓘ
include_js_files!(
"01_hello.js",
"02_goodbye.js",
)
// Produces following specifiers:
- "ext:my_extension/01_hello.js"
- "ext:my_extension/02_goodbye.js"
/// Example with "dir" option (for "my_extension"):
```ignore
include_js_files!(
dir "js",
"01_hello.js",
"02_goodbye.js",
)
// Produces following specifiers:
- "ext:my_extension/js/01_hello.js"
- "ext:my_extension/js/02_goodbye.js"