From 3729ddcb1e6cf2614933c922e2ed7af7ddd42b9e Mon Sep 17 00:00:00 2001 From: ctron Date: Wed, 30 Oct 2024 10:03:19 +0000 Subject: [PATCH] deploy: 340ab327af30d71df8374374f4be537ea5da1113 --- guide/configuration/schema.html | 4 ++-- guide/print.html | 4 ++-- guide/searchindex.js | 2 +- guide/searchindex.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/guide/configuration/schema.html b/guide/configuration/schema.html index a067142a..fec6be65 100644 --- a/guide/configuration/schema.html +++ b/guide/configuration/schema.html @@ -188,10 +188,10 @@

Con

Obtaining the schema

You can generate the schema by running:

-
trunk config schema
+
trunk config generate-schema
 

Or directly write it to a file:

-
trunk config schema path/to/file
+
trunk config generate-schema path/to/file
 

Editor/IDE support

Your editor/IDE needs to support this functionality. Trunk only provides the schema. The following sections provide diff --git a/guide/print.html b/guide/print.html index 1c444651..bd35c9dd 100644 --- a/guide/print.html +++ b/guide/print.html @@ -464,10 +464,10 @@

Required ve

Obtaining the schema

You can generate the schema by running:

-
trunk config schema
+
trunk config generate-schema
 

Or directly write it to a file:

-
trunk config schema path/to/file
+
trunk config generate-schema path/to/file
 

Editor/IDE support

Your editor/IDE needs to support this functionality. Trunk only provides the schema. The following sections provide diff --git a/guide/searchindex.js b/guide/searchindex.js index da5bddfb..b26b6018 100644 --- a/guide/searchindex.js +++ b/guide/searchindex.js @@ -1 +1 @@ -Object.assign(window.search, {"doc_urls":["introduction.html#introduction","getting-started/index.html#getting-started","getting-started/pre-reqs.html#pre-requisites","getting-started/pre-reqs.html#rust","getting-started/pre-reqs.html#webassembly-target","getting-started/installation.html#installation","getting-started/installation.html#installing-from-source","getting-started/installation.html#installing-a-release-from-cratesio","getting-started/installation.html#installing-from-git-directly","getting-started/installation.html#installing-from-the-local-directory","getting-started/installation.html#installing-a-pre-compiled-binary-from-trunk","getting-started/installation.html#download-from-github-releases","getting-started/installation.html#using-cargo-binstall","getting-started/installation.html#distributions","getting-started/installation.html#brew","getting-started/installation.html#fedora","getting-started/installation.html#nix-os","getting-started/installation.html#update-check","getting-started/project.html#a-basic-project","getting-started/project.html#creating-a-project","getting-started/project.html#next-steps","commands/index.html#commands","commands/index.html#build","commands/index.html#watch","commands/index.html#serve","commands/index.html#clean","commands/index.html#config-show","commands/index.html#tools-show","configuration/index.html#configuration","configuration/index.html#configuration-files","configuration/index.html#formats","configuration/index.html#command-line-arguments-and-environment-variables","configuration/index.html#migration-from-pre-0210-the-best-approach-to-moving-forward","configuration/index.html#required-version","configuration/schema.html#configuration-schema","configuration/schema.html#obtaining-the-schema","configuration/schema.html#editoride-support","configuration/schema.html#intellij-and-alike","build/hooks.html#hooks","build/hooks.html#build-steps","build/hooks.html#hook-execution","build/hooks.html#os-specific-overrides","assets/index.html#assets","assets/index.html#link-asset-types","assets/index.html#rust","assets/index.html#sassscss","assets/index.html#css","assets/index.html#tailwind","assets/index.html#icon","assets/index.html#inline","assets/index.html#copy-file","assets/index.html#copy-dir","assets/index.html#script-asset-types","assets/index.html#script-assets","assets/index.html#js-snippets","assets/index.html#images--other-resources","assets/index.html#directives","assets/minification.html#minification","assets/sri.html#sub-resource-integrity","advanced/index.html#advanced","advanced/javascript_interop.html#javascript-interoperability","advanced/javascript_interop.html#order-of-initialization","advanced/startup_event.html#startup-event","advanced/startup_event.html#definition","advanced/startup_event.html#example","advanced/initializer.html#initializer","advanced/library.html#library-crate","advanced/paths.html#base-urls-public-urls-paths--reverse-proxies","advanced/proxy.html#backend-proxy","advanced/proxy.html#proxy-cli-flags","advanced/proxy.html#config-file","contributing.html#contributing"],"index":{"documentStore":{"docInfo":{"0":{"body":35,"breadcrumbs":2,"title":1},"1":{"body":10,"breadcrumbs":4,"title":2},"10":{"body":6,"breadcrumbs":8,"title":5},"11":{"body":18,"breadcrumbs":6,"title":3},"12":{"body":34,"breadcrumbs":6,"title":3},"13":{"body":26,"breadcrumbs":4,"title":1},"14":{"body":9,"breadcrumbs":4,"title":1},"15":{"body":10,"breadcrumbs":4,"title":1},"16":{"body":8,"breadcrumbs":5,"title":2},"17":{"body":49,"breadcrumbs":5,"title":2},"18":{"body":23,"breadcrumbs":6,"title":2},"19":{"body":112,"breadcrumbs":6,"title":2},"2":{"body":15,"breadcrumbs":6,"title":2},"20":{"body":48,"breadcrumbs":6,"title":2},"21":{"body":8,"breadcrumbs":2,"title":1},"22":{"body":32,"breadcrumbs":2,"title":1},"23":{"body":14,"breadcrumbs":2,"title":1},"24":{"body":9,"breadcrumbs":2,"title":1},"25":{"body":9,"breadcrumbs":2,"title":1},"26":{"body":15,"breadcrumbs":3,"title":2},"27":{"body":14,"breadcrumbs":3,"title":2},"28":{"body":71,"breadcrumbs":2,"title":1},"29":{"body":55,"breadcrumbs":3,"title":2},"3":{"body":38,"breadcrumbs":5,"title":1},"30":{"body":49,"breadcrumbs":2,"title":1},"31":{"body":45,"breadcrumbs":6,"title":5},"32":{"body":98,"breadcrumbs":8,"title":7},"33":{"body":68,"breadcrumbs":3,"title":2},"34":{"body":15,"breadcrumbs":4,"title":2},"35":{"body":13,"breadcrumbs":4,"title":2},"36":{"body":12,"breadcrumbs":4,"title":2},"37":{"body":17,"breadcrumbs":4,"title":2},"38":{"body":21,"breadcrumbs":2,"title":1},"39":{"body":86,"breadcrumbs":3,"title":2},"4":{"body":36,"breadcrumbs":6,"title":2},"40":{"body":129,"breadcrumbs":3,"title":2},"41":{"body":58,"breadcrumbs":4,"title":3},"42":{"body":6,"breadcrumbs":2,"title":1},"43":{"body":53,"breadcrumbs":4,"title":3},"44":{"body":456,"breadcrumbs":2,"title":1},"45":{"body":75,"breadcrumbs":2,"title":1},"46":{"body":91,"breadcrumbs":2,"title":1},"47":{"body":84,"breadcrumbs":2,"title":1},"48":{"body":53,"breadcrumbs":2,"title":1},"49":{"body":40,"breadcrumbs":2,"title":1},"5":{"body":19,"breadcrumbs":4,"title":1},"50":{"body":34,"breadcrumbs":3,"title":2},"51":{"body":35,"breadcrumbs":3,"title":2},"52":{"body":5,"breadcrumbs":4,"title":3},"53":{"body":114,"breadcrumbs":3,"title":2},"54":{"body":25,"breadcrumbs":3,"title":2},"55":{"body":94,"breadcrumbs":3,"title":2},"56":{"body":48,"breadcrumbs":2,"title":1},"57":{"body":96,"breadcrumbs":3,"title":1},"58":{"body":31,"breadcrumbs":7,"title":3},"59":{"body":6,"breadcrumbs":2,"title":1},"6":{"body":43,"breadcrumbs":5,"title":2},"60":{"body":43,"breadcrumbs":5,"title":2},"61":{"body":42,"breadcrumbs":5,"title":2},"62":{"body":15,"breadcrumbs":5,"title":2},"63":{"body":14,"breadcrumbs":4,"title":1},"64":{"body":36,"breadcrumbs":4,"title":1},"65":{"body":136,"breadcrumbs":4,"title":1},"66":{"body":28,"breadcrumbs":5,"title":2},"67":{"body":196,"breadcrumbs":15,"title":7},"68":{"body":27,"breadcrumbs":5,"title":2},"69":{"body":152,"breadcrumbs":6,"title":3},"7":{"body":10,"breadcrumbs":6,"title":3},"70":{"body":59,"breadcrumbs":5,"title":2},"71":{"body":38,"breadcrumbs":2,"title":1},"8":{"body":38,"breadcrumbs":6,"title":3},"9":{"body":16,"breadcrumbs":6,"title":3}},"docs":{"0":{"body":"Trunk is a WebAssembly (WASM) web application bundler for Rust. Trunk uses a simple, optional-config pattern for building & bundling WASM, JS snippets & other assets (images, css, scss) via a source HTML file. Or in layman's terms: Rusty things go in, webby things come out.","breadcrumbs":"Introduction » Introduction","id":"0","title":"Introduction"},"1":{"body":"The following subsections explain what is required to install and use trunk, and how you can start with a basic project.","breadcrumbs":"Getting started » Getting started","id":"1","title":"Getting started"},"10":{"body":"Pre-compiled releases have the default features enabled.","breadcrumbs":"Getting started » Installation » Installing a pre-compiled binary from trunk","id":"10","title":"Installing a pre-compiled binary from trunk"},"11":{"body":"trunk published compiled binaries for various platforms during the release process. They can be found in the GitHub release section of trunk. Just download and extract the binary as you would normally do.","breadcrumbs":"Getting started » Installation » Download from GitHub releases","id":"11","title":"Download from GitHub releases"},"12":{"body":"cargo-binstall allows to install pre-compiled binaries in a more convenient way. Given a certain pattern, it can detect the version from crates.io and then fetch the matching binary from a GitHub release. trunk supports this pattern. So assuming you have installed cargo-binstall already, you can simpy run: cargo binstall trunk","breadcrumbs":"Getting started » Installation » Using cargo binstall","id":"12","title":"Using cargo binstall"},"13":{"body":"Trunk is released by different distributions. In most cases, a distribution will build their own binaries and might not keep default feature flags. It might also be that an update to the most recent version might be delayed by the distribution's release process. As distributions will have their own update management, most likely Trunk's update check is disabled.","breadcrumbs":"Getting started » Installation » Distributions","id":"13","title":"Distributions"},"14":{"body":"trunk is available using brew and can be installed using: brew install trunk","breadcrumbs":"Getting started » Installation » Brew","id":"14","title":"Brew"},"15":{"body":"Starting with Fedora 40, trunk can be installed by executing: sudo dnf install trunk","breadcrumbs":"Getting started » Installation » Fedora","id":"15","title":"Fedora"},"16":{"body":"Using Nix, trunk can be installed using: nix-env -i trunk","breadcrumbs":"Getting started » Installation » Nix OS","id":"16","title":"Nix OS"},"17":{"body":"Since: 0.19.0-alpha.2. Trunk has an update check built in. By default, it will check the trunk crate on crates.io for a newer (non-pre-release) version. If one is found, the information will be shown in the command line. This check can be disabled entirely, by not enabling the cargo feature update_check. It can also be disabled during runtime using the environment variable TRUNK_SKIP_VERSION_CHECK, or using the command line switch --skip-version-check. The actual check with crates.io is only performed every 24 hours.","breadcrumbs":"Getting started » Installation » Update check","id":"17","title":"Update check"},"18":{"body":"For building the web application, trunk is running a combination of tools, mainly cargo build and wasm-bindgen. Therefore, having a simple cargo project and an index.html file as an entry-point is sufficient to get you started.","breadcrumbs":"Getting started » First project » A basic project","id":"18","title":"A basic project"},"19":{"body":"Start with creating a fresh Rust project and change into that folder: cargo new trunk-hello-world\ncd trunk-hello-world Add some dependencies for the web: cargo add wasm-bindgen console_error_panic_hook\ncargo add web_sys -F Window,Document,HtmlElement,Text Inside the newly created project, create a file src/main.rs with the following content: use web_sys::window; fn main() { console_error_panic_hook::set_once(); let document = window() .and_then(|win| win.document()) .expect(\"Could not access the document\"); let body = document.body().expect(\"Could not access document.body\"); let text_node = document.create_text_node(\"Hello, world from Vanilla Rust!\"); body.append_child(text_node.as_ref()) .expect(\"Failed to append text\");\n} Create an index.html in the root of project: \n\n Hello World\n\n\n\n Then, start trunk inside that project to have it built and served: trunk serve --open This should compile the project, run wasm_bindgen, create an index.html based on the original file which loads and initializes the application. The application itself is pretty basic, simply getting the document's body and adding a note.","breadcrumbs":"Getting started » First project » Creating a project","id":"19","title":"Creating a project"},"2":{"body":"While trunk tries to fetch tools automatically as needed (unless you're running with --offline), some pre-requisites may be required, depending on your environment.","breadcrumbs":"Getting started » Pre-requisites » Pre-requisites","id":"2","title":"Pre-requisites"},"20":{"body":"Most likely, you do not want to manually update the DOM tree of your application. You might want to add some assets, tweak the build process, use some more browser APIs, perform some HTTP requests, use existing crates for the web, and maybe even interface with the JavaScript world. However, all of this is an extension to this basic project we just created. Here are some pointers: wasm_bindgen documentation HTML Frameworks (sorted by GitHub stars) Yew Leptos Doxius More More trunk examples","breadcrumbs":"Getting started » First project » Next steps","id":"20","title":"Next steps"},"21":{"body":"Trunk ships with a set of CLI commands to help you in your development workflows.","breadcrumbs":"Commands » Commands","id":"21","title":"Commands"},"22":{"body":"trunk build runs a cargo build targeting the wasm32 instruction set, runs wasm-bindgen on the built WASM, and spawns asset build pipelines for any assets defined in the target index.html. Trunk leverages Rust's powerful concurrency primitives for maximum build speeds & throughput.","breadcrumbs":"Commands » build","id":"22","title":"build"},"23":{"body":"trunk watch does the same thing as trunk build, but also watches the filesystem for changes, triggering new builds as changes are detected.","breadcrumbs":"Commands » watch","id":"23","title":"watch"},"24":{"body":"trunk serve does the same thing as trunk watch, but also spawns a web server.","breadcrumbs":"Commands » serve","id":"24","title":"serve"},"25":{"body":"trunk clean cleans up any build artifacts generated from earlier builds.","breadcrumbs":"Commands » clean","id":"25","title":"clean"},"26":{"body":"trunk config show prints out Trunk's current config, before factoring in CLI arguments. Nice for testing & debugging.","breadcrumbs":"Commands » config show","id":"26","title":"config show"},"27":{"body":"trunk tools show prints out information about tools required by trunk and the project. It shows which tools are expected and which are found.","breadcrumbs":"Commands » tools show","id":"27","title":"tools show"},"28":{"body":"Important Trunk's configuration has massively changed in the 0.21.0 release. The goal was not to break anything, but it might have happened anyway. Also does the layering system work a bit different now. It might also be that the documentation still mentions only Trunk.toml. If that's the case, then this now includes all other configuration file variants as well. Trunk supports a layered configuration system. The base comes from a reasonable set of defaults, overridden by a configuration file, overridden command line arguments. Technically speaking, there's a project configuration struct, which has reasonable defaults. Trunk will try to locate a configuration file and load if into this struct. It will then override this configuration with settings from the command line parser (which includes environment variables).","breadcrumbs":"Configuration » Configuration","id":"28","title":"Configuration"},"29":{"body":"Trunk will try to locate a configuration file. Either in the local directory, or by using the global argument --config, which can accept either a file, or a directory. If the argument is a file, then this file will be used directly. Otherwise, Trunk will load the first file found, searching for: Trunk.toml .trunk.toml Trunk.yaml .trunk.yaml Trunk.json .trunk.json If neither of those files is found, Trunk will use the metadata from the Cargo.toml, which defaults to an empty set of metadata. The directory of the configuration file will become the project root, and all relative files will be resolved based on that project root.","breadcrumbs":"Configuration » Configuration files","id":"29","title":"Configuration files"},"3":{"body":"It might be obvious, but trunk requires an installation of Rust. Not only when installing trunk itself from sources, but also for compiling the Rust-based projects to WebAssembly. The instructions of installing Rust may vary based on your operating system, a reasonable default comes from the Rust project: https://www.rust-lang.org/learn/get-started Once installed, you should have the following tools available on your command line: rustup cargo","breadcrumbs":"Getting started » Pre-requisites » Rust","id":"3","title":"Rust"},"30":{"body":"Trunk's configuration is limited to a JSON compatible model. This means you can easily translate between those different formats. For example, having the following Trunk.toml configuration: [build]\ndist = \"dist\"\n[serve]\nport = 8080 Would be the following in YAML: build: dist: \"dist\"\nserve: port: 8080 Also Cargo.toml is based on that model. However, it moves that data down into the package.metadata.trunk section. The example above would become: [package.metadata.trunk.build]\ndist = \"dist\"\n[package.metadata.trunk.serve]\nport = 8080","breadcrumbs":"Configuration » Formats","id":"30","title":"Formats"},"31":{"body":"Command line arguments can override part of the configuration. Not all configuration aspects can be overridden by the command line arguments though. Command line arguments include the use of environment variables. Trunk supports --help on all levels of commands and sub-commands. This will show you the available options, as well as the names of the environment variables to use instead. All relative paths will be resolved against the project root, as evaluated by loading the configuration.","breadcrumbs":"Configuration » Command line arguments (and environment variables)","id":"31","title":"Command line arguments (and environment variables)"},"32":{"body":"While the goal was to support all fields from Trunk.toml, the command line arguments as well as the environment variables, it still is a version breaking the API. In some cases, it just made little sense, and so those fields got marked \"deprecated\". They trigger a warning today and might be removed in one of the next releases. Ideally, you don't need to change anything. In some ideal cases, you don't even need any configuration. In case you do, you now have some more choices. You can keep using TOML, you may hide it using .trunk.* variant. You can use YAML or JSON to leverage the JSON schema that is generated. Or if you're a fan of keeping everything in Cargo.toml, that's fine too. The choice is yours. Important You need to take care when working with older versions of Trunk though. If you use an older version of Trunk (before 0.21.0) with a project using the newer configuration files, then that version would not consider those files and might consider default settings, due to the missing Trunk.toml file.","breadcrumbs":"Configuration » Migration from pre 0.21.0 the best approach to moving forward","id":"32","title":"Migration from pre 0.21.0 the best approach to moving forward"},"33":{"body":"Starting with 0.19.0-alpha.2, it is possible to enforce having a certain version of trunk building the project. As new features get added to trunk, this might be helpful to ensure that the version of trunk building the current is actually capable of doing so. This can be done using the trunk-version (or using the alias trunk_version) on the root level of the Trunk.toml file. The version format is a \"version requirement\", the same format you might know from Cargo's version field on dependencies. This also supports pre-release requirements, which allows adopting upcoming features early. Note Versions prior do 0.19.0-alpha.2 currently do not support this check, and so they will silently ignore such an error for now.","breadcrumbs":"Configuration » Required version","id":"33","title":"Required version"},"34":{"body":"Trunk provides a JSON schema for the configuration model. This can be added to e.g. a YAML file using the following syntax: $schema: \"./schema.json\"","breadcrumbs":"Configuration » Schema » Configuration Schema","id":"34","title":"Configuration Schema"},"35":{"body":"You can generate the schema by running: trunk config schema Or directly write it to a file: trunk config schema path/to/file","breadcrumbs":"Configuration » Schema » Obtaining the schema","id":"35","title":"Obtaining the schema"},"36":{"body":"Your editor/IDE needs to support this functionality. Trunk only provides the schema. The following sections provide some information on how to use this.","breadcrumbs":"Configuration » Schema » Editor/IDE support","id":"36","title":"Editor/IDE support"},"37":{"body":"IntelliJ based IDEs (including Rust Rover) do support JSON schemas in YAML and JSON files. You only need to reference the schema, like: $schema: \"./schema.json\"","breadcrumbs":"Configuration » Schema » IntelliJ (and alike)","id":"37","title":"IntelliJ (and alike)"},"38":{"body":"If you find that you need Trunk to perform an additional build action that isn't supported directly, then Trunk's flexible hooks system can be used to launch external processes at various stages in the pipeline.","breadcrumbs":"Hooks » Hooks","id":"38","title":"Hooks"},"39":{"body":"This is a brief overview of Trunk's build process for the purpose of describing when hooks are executed. Please note that the exact ordering may change in the future to add new features. Step 1 — Read and parse the HTML file. Step 2 — Produce a plan of all assets to be built. Step 3 — Build all assets in parallel. Step 4 — Finalize and write assets to staging directory. Step 5 — Write HTML to staging directory. Step 6 - Replace dist directory contents with staging directory contents. The hook stages correspond to this as follows: pre_build: takes place before step 1. build: takes place at the same time as step 3, executing in parallel with asset builds. post_build: takes place after step 5 and before step 6.","breadcrumbs":"Hooks » Build steps","id":"39","title":"Build steps"},"4":{"body":"By default, the Rust installation will only install the target for your current machine. However, in this case, we want to cross-compile to WebAssembly. Therefore, it is required to install the target wasm32-unknown-unknown. Assuming you have installed Rust using the standard process and can use rustup, you can add the target using: rustup target add wasm32-unknown-unknown","breadcrumbs":"Getting started » Pre-requisites » WebAssembly target","id":"4","title":"WebAssembly target"},"40":{"body":"Hooks can be declared exclusively in Trunk.toml, and consist of a stage, command and command_arguments: stage: (required) one of pre_build, build or post_build. It specifies when in Trunk's build pipeline the hook is executed. command: (required) the name or path to the desired executable. command_arguments: (optional, defaults to none) any arguments to be passed, in the given order, to the executable. At the relevant point for each stage, all hooks for that stage are spawned simultaneously. After this, Trunk immediately waits for all the hooks to exit before proceeding, except in the case of the build stage, described further below. All hooks are executed using the same stdin and stdout as trunk. The executable is expected to return an error code of 0 to indicate success. Any other code will be treated as an error and terminate the build process. Additionally, the following environment variables are provided to the process: TRUNK_PROFILE: the build profile in use. Currently, either debug or release. TRUNK_HTML_FILE: the full path to the HTML file (typically index.html in TRUNK_SOURCE_DIR) used by trunk. TRUNK_SOURCE_DIR: the full path to the source directory in use by Trunk. This is always the directory in which TRUNK_HTML_FILE resides. TRUNK_STAGING_DIR: the full path of the Trunk staging directory. TRUNK_DIST_DIR: the full path of the Trunk dist directory. TRUNK_PUBLIC_URL: the configured public URL for Trunk.","breadcrumbs":"Hooks » Hook execution","id":"40","title":"Hook execution"},"41":{"body":"Often times you will want to perform the same build step on different OSes, requiring different commands. A typical example of this is using the sh command on Linux, but cmd on Windows. To accomodate this, you can optionally create OS-specific overrides for each hook. To do this, specify the default hook, then directly below it create a [hooks.] entry where can be one of windows, macos, or linux. Within this entry you must specify only the command and command_argumnets keys. You may provide multiple overrides for each hook. i.e. One for windows, one for macos, and one for linux.","breadcrumbs":"Hooks » OS-specific overrides","id":"41","title":"OS-specific overrides"},"42":{"body":"Declaring assets to be processed by Trunk is simple and extensible.","breadcrumbs":"Assets » Assets","id":"42","title":"Assets"},"43":{"body":"All link assets to be processed by Trunk must follow these three rules: Must be declared as a valid HTML link tag. Must have the attribute data-trunk. Must have the attribute rel=\"{type}\", where {type} is one of the asset types listed below. This will typically look like: . Each asset type described below specifies the required and optional attributes for its asset type. All HTML elements will be replaced with the output HTML of the associated pipeline.","breadcrumbs":"Assets » Link Asset Types","id":"43","title":"Link Asset Types"},"44":{"body":"✅ rel=\"rust\": Trunk will compile the specified Cargo project as WASM and load it. This is optional. If not specified, Trunk will look for a Cargo.toml in the parent directory of the source HTML file. href: (optional) the path to the Cargo.toml of the Rust project. If a directory is specified, then Trunk will look for the Cargo.toml in the given directory. If no value is specified, then Trunk will look for a Cargo.toml in the parent directory of the source HTML file. data-target-name: (optional) the name of the target artifact to load. If the Cargo project has multiple targets (binaries and library), this value can be used to select which one should be used by trunk. data-bin: (optional) the name of the binary to compile and load. If the Cargo project has multiple binaries, this value can be used to specify that a specific binary should be compiled (using --bin) and used by trunk. This implicitly includes data-target-name. data-type: (optional) specifies how the binary should be loaded into the project. Can be set to main or worker. main is the default. There can only be one main link. For workers a wasm-bindgen javascript wrapper and the wasm file (with _bg.wasm suffix) is created, named after the binary name (if provided) or project name. See one of the webworker examples on how to load them. data-cargo-features: (optional) Space or comma separated list of cargo features to activate. data-cargo-no-default-features: (optional) Disables the default Cargo features. data-cargo-all-features: (optional) Enables all Cargo features. Neither compatible with data-cargo-features nor data-cargo-no-default-features. data-wasm-opt: (optional) run wasm-opt with the set optimization level. The possible values are 0, 1, 2, 3, 4, s, z or an empty value for wasm-opt's default. Set this option to 0 to disable wasm-opt explicitly. The values 1-4 are increasingly stronger optimization levels for speed. s and z (z means more optimization) optimize for binary size instead. Only used in --release mode. data-keep-debug: (optional) instruct wasm-bindgen to preserve debug info in the final WASM output, even for --release mode. This may conflict with the use of wasm-opt, so to be sure, it is recommended to set data-wasm-opt=\"0\" when using this option. data-no-demangle: (optional) instruct wasm-bindgen to not demangle Rust symbol names. data-reference-types: (optional) instruct wasm-bindgen to enable reference types . data-weak-refs: (optional) instruct wasm-bindgen to enable weak references . data-typescript: (optional) instruct wasm-bindgen to output Typescript bindings. Defaults to false. data-bindgen-target: (optional) specifies the value of the wasm-bindgen flag --target (see link for possible values). Defaults to no-modules. The main use-case is to switch to web with data-type=\"worker\" which reduces backwards compatibility but with some advantages . data-loader-shim: (optional) instruct trunk to create a loader shim for web workers. Defaults to false. data-cross-origin: (optional) the crossorigin setting when loading the code & script resources. Defaults to plain anonymous. data-integrity: (optional) the integrity digest type for code & script resources. Defaults to plain sha384. data-wasm-no-import: (optional) by default, Trunk will generate an import of functions exported from Rust. Enabling this flag disables this feature. Defaults to false. data-wasm-import-name: (optional) the name of the global variable where the functions imported from WASM will be available (under the window object). Defaults to wasmBindings (which makes them available via window.wasmBindings.). data-target-path: (optional) Path where the output is placed inside the dist dir. If not present, the directory is placed in the dist root. The path must be a relative path without ... data-initializer: (optional) Path to the (module) JavaScript file of the initializer . data-cargo-profile: (optional) A cargo profile to use, instead of the default, for both release or dev mode. data-cargo-profile-release: (optional) A cargo profile to use, instead of the default, for the release mode. Overrides the data-cargo-profile setting. data-cargo-profile-dev: (optional) A cargo profile to use, instead of the default, for the dev mode. Overrides the data-cargo-profile setting.","breadcrumbs":"Assets » rust","id":"44","title":"rust"},"45":{"body":"✅ rel=\"sass\" or rel=\"scss\": Trunk uses the official dart-sass for compilation. Just link to your sass files from your source HTML, and Trunk will handle the rest. This content is hashed for cache control. The href attribute must be included in the link pointing to the sass/scss file to be processed. data-inline: (optional) this attribute will inline the compiled CSS from the SASS/SCSS file into a