The assets
module contains a foreign variable named files
that holds references to the package’s files. You can use this variable to get the full path or URL of a file.
folder-1/folder-2/foo.ftd
present in dependency package named other-package
. You need to write the following code:-- import: other-package/assets -- ftd.text: Link to foo.ftd link: $assets.files.folder-1.folder-2.foo.ftd
The $assets.files.folder-1.folder-2.foo.ftd
reference will return a string with a value like ``-/other-package/folder-1/folder-2/foo.ftd`.
assets
reference returns a ftd.image-src
value that includes values for both light and dark modes.assets
reference returns a ftd.image-src
type for them.logo.png
) anywhere in your package (e.g., inside static
directory), and use the following code to access it:-- import: <package-name>/assets -- ftd.image: src: $assets.files.static.logo.png
assets.files.static.logo.png
is ftd.image-src
with a value like this:-- ftd.image-src assets.files.static.logo.png: light: -/<package-name>/static/logo.png dark: -/<package-name>/static/logo.png
If you want a different images for both light and dark mode, then add an image, say logo.png
(for light mode) and logo-dark.png
(for dark mode), somewhere in your package, say inside static
folder.
logo.png
for light mode and logo-dark.png
for dark mode) anywhere in your package (e.g., inside static
directory), and use the following code to access them:-- import: <package-name>/assets -- ftd.image: src: $assets.files.static.logo.png
assets.files.static.logo.png
is ftd.image-src
with a value like this:-- ftd.image-src assets.files.static.logo.png: light: -/<package-name>/static/logo.png dark: -/<package-name>/static/logo-dark.png
Have a question or need help?
Visit our GitHub Q&A discussion to get answers and subscribe to it to stay tuned.
Join our Discord channel and share your thoughts, suggestion, question etc.
Connect with our community!We welcome you to join our Discord community today.
We are trying to create the language for human beings and we do not believe it would be possible without your support. We would love to hear from you.