Skip to content

Commit

Permalink
deploy: 9678faa
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed May 2, 2024
1 parent 5f14d1e commit 1d2d118
Show file tree
Hide file tree
Showing 73 changed files with 12,064 additions and 102 deletions.
68 changes: 34 additions & 34 deletions advanced/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<link href="https://fonts.googleapis.com/css?family=Alfa+Slab+One&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/normalize.css">
<link rel="stylesheet" href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;juice.css">
<link rel="stylesheet" href="https://trunkrs.dev/juice.css">

<link rel="icon" type="image/svg+xml" href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;rustacean-flat-happy.svg">
<link rel="stylesheet" type="text/css" href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;custom.css">
<link rel="icon" type="image/svg+xml" href="https://trunkrs.dev/rustacean-flat-happy.svg">
<link rel="stylesheet" type="text/css" href="https://trunkrs.dev/custom.css">

</head>

Expand All @@ -37,7 +37,7 @@

<a href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;">
<div class="logo">
<img src="https:&#x2F;&#x2F;trunkrs.dev&#x2F;rustacean-flat-happy.svg" alt="logo">
<img src="https://trunkrs.dev/rustacean-flat-happy.svg" alt="logo">
Trunk
</div>
</a>
Expand Down Expand Up @@ -113,13 +113,13 @@ <h2 id="javascript-interoperability">JavaScript interoperability</h2>
<h2 id="library-crate">Library crate</h2>
<p>Aside from having a <code>main</code> function, it is also possible to up your project as a <code>cdylib</code> project. In order to do that,
add the following to your <code>Cargo.toml</code>:</p>
<pre><code>[lib]
crate-type = [&quot;cdylib&quot;, &quot;rlib&quot;]
</code></pre>
<pre data-lang="toml" style="background-color:#ffffff;color:#323232;" class="language-toml "><code class="language-toml" data-lang="toml"><span>[lib]
</span><span style="color:#63a35c;">crate-type </span><span>= [</span><span style="color:#183691;">&quot;cdylib&quot;</span><span>, </span><span style="color:#183691;">&quot;rlib&quot;</span><span>]
</span></code></pre>
<p>And then, define the entrypoint in your <code>lib.rs</code> like (does not need to be <code>async</code>):</p>
<pre><code>#[wasm_bindgen(start)]
pub async fn run() {}
</code></pre>
<pre data-lang="rust" style="background-color:#ffffff;color:#323232;" class="language-rust "><code class="language-rust" data-lang="rust"><span>#[wasm_bindgen(start)]
</span><span style="font-weight:bold;color:#a71d5d;">pub</span><span> async </span><span style="font-weight:bold;color:#a71d5d;">fn </span><span style="font-weight:bold;color:#795da3;">run</span><span>() {}
</span></code></pre>
<h2 id="initializer">Initializer</h2>
<p>Since: <code>0.19.0-alpha.1</code>.</p>
<p>Trunk supports tapping into the initialization process of the WASM application. By
Expand All @@ -130,30 +130,30 @@ <h2 id="initializer">Initializer</h2>
load the WASM file, nor when something goes wrong.</p>
<p>Now it is possible to tap into this process by setting <code>data-initializer</code> to a JavaScript module file. This module file
is required to (default) export a function, which returns the &quot;initializer&quot; instance. Here is an example:</p>
<pre><code>export default function myInitializer () {
return {
onStart: () =&gt; {
// called when the loading starts
},
onProgress: ({current, total}) =&gt; {
// the progress while loading, will be called periodically.
// &quot;current&quot; will contain the number of bytes of the WASM already loaded
// &quot;total&quot; will either contain the total number of bytes expected for the WASM, or if the server did not provide
// the content-length header it will contain 0.
},
onComplete: () =&gt; {
// called when the initialization is complete (successfully or failed)
},
onSuccess: (wasm) =&gt; {
// called when the initialization is completed successfully, receives the `wasm` instance
},
onFailure: (error) =&gt; {
// called when the initialization is completed with an error, receives the `error`
}
}
};
</code></pre>
<p>For a full example, see: <a href="https://github.com/trunk-rs/trunk/examples/initializer">https://github.com/trunk-rs/trunk/examples/initializer</a>.</p>
<pre data-lang="javascript" style="background-color:#ffffff;color:#323232;" class="language-javascript "><code class="language-javascript" data-lang="javascript"><span style="font-weight:bold;color:#a71d5d;">export default function </span><span style="font-weight:bold;color:#795da3;">myInitializer </span><span>() {
</span><span> </span><span style="font-weight:bold;color:#a71d5d;">return </span><span>{
</span><span> </span><span style="font-weight:bold;color:#795da3;">onStart</span><span>: () </span><span style="font-weight:bold;color:#a71d5d;">=&gt; </span><span>{
</span><span> </span><span style="font-style:italic;color:#969896;">// called when the loading starts
</span><span> },
</span><span> </span><span style="font-weight:bold;color:#795da3;">onProgress</span><span>: ({current, total}) </span><span style="font-weight:bold;color:#a71d5d;">=&gt; </span><span>{
</span><span> </span><span style="font-style:italic;color:#969896;">// the progress while loading, will be called periodically.
</span><span> </span><span style="font-style:italic;color:#969896;">// &quot;current&quot; will contain the number of bytes of the WASM already loaded
</span><span> </span><span style="font-style:italic;color:#969896;">// &quot;total&quot; will either contain the total number of bytes expected for the WASM, or if the server did not provide
</span><span> </span><span style="font-style:italic;color:#969896;">// the content-length header it will contain 0.
</span><span> },
</span><span> </span><span style="font-weight:bold;color:#795da3;">onComplete</span><span>: () </span><span style="font-weight:bold;color:#a71d5d;">=&gt; </span><span>{
</span><span> </span><span style="font-style:italic;color:#969896;">// called when the initialization is complete (successfully or failed)
</span><span> },
</span><span> </span><span style="font-weight:bold;color:#795da3;">onSuccess</span><span>: (wasm) </span><span style="font-weight:bold;color:#a71d5d;">=&gt; </span><span>{
</span><span> </span><span style="font-style:italic;color:#969896;">// called when the initialization is completed successfully, receives the `wasm` instance
</span><span> },
</span><span> </span><span style="font-weight:bold;color:#795da3;">onFailure</span><span>: (error) </span><span style="font-weight:bold;color:#a71d5d;">=&gt; </span><span>{
</span><span> </span><span style="font-style:italic;color:#969896;">// called when the initialization is completed with an error, receives the `error`
</span><span> }
</span><span> }
</span><span>};
</span></code></pre>
<p>For a full example, see: <a href="https://github.com/trunk-rs/trunk/tree/main/examples/initializer">https://github.com/trunk-rs/trunk/tree/main/examples/initializer</a>.</p>
<h2 id="update-check">Update check</h2>
<p>Since: <code>0.19.0-alpha.2</code>.</p>
<p>Trunk has an update check built in. By default, it will check the <code>trunk</code> crate on <code>crates.io</code> for a newer
Expand Down
32 changes: 25 additions & 7 deletions assets/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<link href="https://fonts.googleapis.com/css?family=Alfa+Slab+One&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/normalize.css">
<link rel="stylesheet" href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;juice.css">
<link rel="stylesheet" href="https://trunkrs.dev/juice.css">

<link rel="icon" type="image/svg+xml" href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;rustacean-flat-happy.svg">
<link rel="stylesheet" type="text/css" href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;custom.css">
<link rel="icon" type="image/svg+xml" href="https://trunkrs.dev/rustacean-flat-happy.svg">
<link rel="stylesheet" type="text/css" href="https://trunkrs.dev/custom.css">

</head>

Expand All @@ -37,7 +37,7 @@

<a href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;">
<div class="logo">
<img src="https:&#x2F;&#x2F;trunkrs.dev&#x2F;rustacean-flat-happy.svg" alt="logo">
<img src="https://trunkrs.dev/rustacean-flat-happy.svg" alt="logo">
Trunk
</div>
</a>
Expand Down Expand Up @@ -160,6 +160,11 @@
</div>


<div class="toc-item">
<a class="subtext" href="https://trunkrs.dev/assets/#minification">Minification</a>
</div>


</div>
</div>

Expand Down Expand Up @@ -217,20 +222,22 @@ <h2 id="css">css</h2>
<ul>
<li>In the future, Trunk will resolve local <code>@imports</code>, will handle minification (see <a href="https://github.com/trunk-rs/trunk/issues/7">trunk#7</a>), and we may even look into a pattern where any CSS found in the source tree will be bundled, which would enable a nice zero-config &quot;component styles&quot; pattern. See <a href="https://github.com/trunk-rs/trunk/issues/3">trunk#3</a> for more details.</li>
<li><code>data-integrity</code>: (optional) the <code>integrity</code> digest type for code &amp; script resources. Defaults to plain <code>sha384</code>.</li>
<li><code>data-no-minify</code>: (optional) by default, CSS files are minified in <code>--release</code> mode (unless building with <code>--no-minification</code>). Setting this attribute disables minification for that particular file. Defaults to false.</li>
<li><code>data-no-minify</code>: (optional) Opt-out of minification. Also see: <a href="https://trunkrs.dev/assets/#minification">Minification</a>.</li>
<li><code>data-target-path</code>: (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 <code>..</code>.</li>
</ul>
<h2 id="tailwind">tailwind</h2>
<p><code>rel=&quot;tailwind-css&quot;</code>: Trunk uses the official <a href="https://tailwindcss.com/blog/standalone-cli">tailwindcss cli</a> for compilation. Just link to your tailwind css files from your source HTML, and Trunk will handle the rest. This content is hashed for cache control. The <code>href</code> attribute must be included in the link pointing to the sass/scss file to be processed.</p>
<ul>
<li><code>data-inline</code>: (optional) this attribute will inline the compiled CSS from the tailwind compilation into a <code>&lt;style&gt;</code> tag instead of using a <code>&lt;link rel=&quot;stylesheet&quot;&gt;</code> tag.</li>
<li><code>data-integrity</code>: (optional) the <code>integrity</code> digest type for code &amp; script resources. Defaults to plain <code>sha384</code>.</li>
<li><code>data-no-minify</code>: (optional) Opt-out of minification. Also see: <a href="https://trunkrs.dev/assets/#minification">Minification</a>.</li>
<li><code>data-target-path</code>: (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 <code>..</code>.</li>
</ul>
<h2 id="icon">icon</h2>
<p><code>rel=&quot;icon&quot;</code>: Trunk will copy the icon image specified in the <code>href</code> attribute to the <code>dist</code> dir. This content is hashed for cache control.</p>
<ul>
<li><code>data-integrity</code>: (optional) the <code>integrity</code> digest type for code &amp; script resources. Defaults to plain <code>sha384</code>.</li>
<li><code>data-no-minify</code>: (optional) Opt-out of minification. Also see: <a href="https://trunkrs.dev/assets/#minification">Minification</a>.</li>
<li><code>data-target-path</code>: (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 <code>..</code>.</li>
</ul>
<h2 id="inline">inline</h2>
Expand Down Expand Up @@ -264,10 +271,10 @@ <h2 id="script-assets">Script Assets</h2>
<li>Must have the attribute <code>data-trunk</code>.</li>
<li>Must have the attribute <code>src</code>, pointing to a script file</li>
</ul>
<p>This will typically look like: <code>&lt;script data-trunk src=&quot;{path}&quot; ..other options here.. /&gt;</code>. All <code>&lt;script data-trunk .../&gt;</code> HTML elements will be replaced with the output HTML of the associated pipeline.</p>
<p>This will typically look like: <code>&lt;script data-trunk src=&quot;{path}&quot; ..other options here..&gt;&lt;/script&gt;</code>. All <code>&lt;script data-trunk ...&gt;&lt;/script&gt;</code> HTML elements will be replaced with the output HTML of the associated pipeline.</p>
<p>Trunk will copy script files found in the source HTML without content modification. This content is hashed for cache control. The <code>src</code> attribute must be included in the script pointing to the script file to be processed.</p>
<ul>
<li><code>data-no-minify</code>: (optional) by default, scripts are minified in <code>--release</code> mode (unless building with <code>--no-minification</code>). Setting this attribute disables minification for that particular file. Defaults to false.</li>
<li><code>data-no-minify</code>: (optional) Opt-out of minification. Also see: <a href="https://trunkrs.dev/assets/#minification">Minification</a>.</li>
<li><code>data-target-path</code>: (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 <code>..</code>.</li>
</ul>
<h2 id="js-snippets">JS Snippets</h2>
Expand Down Expand Up @@ -327,6 +334,17 @@ <h2 id="hook-environment-execution">Hook Environment &amp; Execution</h2>
</ul>
<h1 id="auto-reload">Auto-Reload</h1>
<p>As of <code>v0.14.0</code>, Trunk now ships with the ability to automatically reload your web app as the Trunk build pipeline completes.</p>
<h1 id="minification">Minification</h1>
<p>Trunk supports minifying of assets. This is disabled by default and can be controlled on various levels.</p>
<p>In any case, Trunk does not perform minification itself, but delegates the process to dependencies which do the actual
implementation. In cases where minification breaks things, it will, most likely, be an issue with that dependency.</p>
<p>Starting with Trunk 0.20.0, minification is disabled by default. It can be turned on from the command line using the
<code>--minify</code> (or <code>-M</code>) switch. Alternatively, it can be controlled using the <code>build.minify</code> field in the <code>Trunk.toml</code>
file. The value of this field is an enum, with the following possible values: <code>never</code> (default, never minify),
<code>on_release</code> (minify when running Trunk with <code>--release</code>), <code>always</code> (always minify).</p>
<p>When minification is enabled, all assets known to trunk (this excludes the <code>copy-dir</code> and <code>copy-file</code> opaque blobs to
Trunk), will get minified. It is possible to opt out of this process on a per-asset basis using the <code>data-no-minify</code>
attribute (see individual asset configuration). In this case, the asset will <em>never</em> get minified.</p>


</div>
Expand Down
2 changes: 1 addition & 1 deletion blog-post.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.trunk-blog-author{margin:0 0 2em 0;padding:0;font-size:0.8em}.trunk-blog-author p{margin:0;padding:0}
.trunk-blog-author{margin:0 0 2em 0;padding:0;font-size:.8em}.trunk-blog-author p{margin:0;padding:0}
8 changes: 4 additions & 4 deletions commands/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<link href="https://fonts.googleapis.com/css?family=Alfa+Slab+One&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/normalize.css">
<link rel="stylesheet" href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;juice.css">
<link rel="stylesheet" href="https://trunkrs.dev/juice.css">

<link rel="icon" type="image/svg+xml" href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;rustacean-flat-happy.svg">
<link rel="stylesheet" type="text/css" href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;custom.css">
<link rel="icon" type="image/svg+xml" href="https://trunkrs.dev/rustacean-flat-happy.svg">
<link rel="stylesheet" type="text/css" href="https://trunkrs.dev/custom.css">

</head>

Expand All @@ -37,7 +37,7 @@

<a href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;">
<div class="logo">
<img src="https:&#x2F;&#x2F;trunkrs.dev&#x2F;rustacean-flat-happy.svg" alt="logo">
<img src="https://trunkrs.dev/rustacean-flat-happy.svg" alt="logo">
Trunk
</div>
</a>
Expand Down
16 changes: 8 additions & 8 deletions configuration/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
<link href="https://fonts.googleapis.com/css?family=Alfa+Slab+One&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="/normalize.css">
<link rel="stylesheet" href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;juice.css">
<link rel="stylesheet" href="https://trunkrs.dev/juice.css">

<link rel="icon" type="image/svg+xml" href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;rustacean-flat-happy.svg">
<link rel="stylesheet" type="text/css" href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;custom.css">
<link rel="icon" type="image/svg+xml" href="https://trunkrs.dev/rustacean-flat-happy.svg">
<link rel="stylesheet" type="text/css" href="https://trunkrs.dev/custom.css">

</head>

Expand All @@ -37,7 +37,7 @@

<a href="https:&#x2F;&#x2F;trunkrs.dev&#x2F;">
<div class="logo">
<img src="https:&#x2F;&#x2F;trunkrs.dev&#x2F;rustacean-flat-happy.svg" alt="logo">
<img src="https://trunkrs.dev/rustacean-flat-happy.svg" alt="logo">
Trunk
</div>
</a>
Expand Down Expand Up @@ -132,10 +132,10 @@ <h2 id="config-file">Config File</h2>
<p>The <code>Trunk.toml</code> config file accepts multiple <code>[[proxy]]</code> sections, which allows for multiple proxies to be configured. Each section requires at least the <code>backend</code> field, and optionally accepts the <code>rewrite</code> and <code>ws</code> fields, both corresponding to the <code>--proxy-*</code> CLI flags discussed above.</p>
<p>As it is with other Trunk config, a proxy declared via CLI will take final precedence and will cause any config file proxies to be ignored, even if there are multiple proxies declared in the config file.</p>
<p>The following is a snippet from the <code>Trunk.toml</code> file in the Trunk repo:</p>
<pre><code>[[proxy]]
rewrite = &quot;/api/v1/&quot;
backend = &quot;http://localhost:9000/&quot;
</code></pre>
<pre data-lang="toml" style="background-color:#ffffff;color:#323232;" class="language-toml "><code class="language-toml" data-lang="toml"><span>[[proxy]]
</span><span style="color:#63a35c;">rewrite </span><span>= </span><span style="color:#183691;">&quot;/api/v1/&quot;
</span><span style="color:#63a35c;">backend </span><span>= </span><span style="color:#183691;">&quot;http://localhost:9000/&quot;
</span></code></pre>
<h3 id="required-version">Required version</h3>
<p>Starting with <code>0.19.0-alpha.2</code>, it is possible to enforce having a certain version of trunk building the project.</p>
<p>As new features get added to trunk, this might be helpful to ensure that the version of trunk building the current
Expand Down
2 changes: 1 addition & 1 deletion custom.css
Original file line number Diff line number Diff line change
@@ -1 +1 @@
.content pre>code{padding:unset}
.content pre>code{padding:unset}
2 changes: 1 addition & 1 deletion elasticlunr.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions guide/.nojekyll
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file makes sure that Github Pages doesn't process mdBook's output.

0 comments on commit 1d2d118

Please sign in to comment.