mte/unikernel/duniverse/dune_/doc/howto/bundle.rst
2025-11-11 02:07:51 +01:00

41 lines
789 B
ReStructuredText
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

How to Bundle Resources
=======================
This guide will show you how to configure Dune to generate modules with string resources
from other files in your project.
Folder Structure
----------------
.. code:: console
$ tree src
src
└── lib
   └── my_lib
   ├── dune
   └── resources
      └── site.css
Dune Configuration
------------------
See :doc:`/reference/actions/progn` and
:doc:`/reference/actions/with-outputs-to`.
.. code:: dune
(rule
(with-stdout-to
css.ml
(progn
(echo "let css = {|")
(cat resources/site.css)
(echo "|}"))))
Using the Bundled Resource
--------------------------
.. code:: ocaml
let () = Printf.printf "%s" Css.css