mirror of
https://codeberg.org/vegvisir/website.git
synced 2025-09-13 16:33:42 +02:00
52 lines
No EOL
2 KiB
PHP
52 lines
No EOL
2 KiB
PHP
<?= VV::include("public/docs/v3.1.5/Reference/layout") ?>
|
|
<main>
|
|
<section>
|
|
<h1>VV::js()</h1>
|
|
<p>Include a JavaScript source file into a page which will be automatically minified and inlined.</p>
|
|
</section>
|
|
<section>
|
|
<?= VV::include("snippets/HTMLCodeDemoElement/HTMLCodeDemoElement?id=docs/v3.1.5/PHP/VV/js/description") ?>
|
|
</section>
|
|
<section>
|
|
<h1>Parameters</h1>
|
|
</section>
|
|
<section class="md param">
|
|
<h3><code class="mtk6">string</code></h3>
|
|
<h2><code class="mtk10">$pathname</code></h2>
|
|
<p>Path to a JavaScript source file.</p>
|
|
<p>Appending ".js" to the filename is optional. If omitted, the extension is infered.</p>
|
|
</section>
|
|
<section class="md param">
|
|
<h3><code class="mtk6">bool</code></h3>
|
|
<h2><code class="mtk10">$relative</code></h2>
|
|
<p>Flag which when set to:</p>
|
|
<ol>
|
|
<li class="default">
|
|
<code class="mtk6">true</code>
|
|
<p>Will make <code class="mtk10">$pathname</code> look for a JavaScript source file relative to <a href="/docs/v3.1.5/Reference/Env#root_path"><code>root_path</code></a>.</p>
|
|
</li>
|
|
<li>
|
|
<code class="mtk6">false</code>
|
|
<p>Will make <code class="mtk10">$pathname</code> look for a JavaScript source file relative to the root of the whole filesystem.</p>
|
|
</li>
|
|
</ol>
|
|
</section>
|
|
<section>
|
|
<h1>Return value</h1>
|
|
</section>
|
|
<section>
|
|
<h3><code class="mtk6">string</code></h3>
|
|
<p>Returns a minified version of the included JavaScript source file as a string. If a file can not be found at <code class="mtk10">$pathname</code>, an empty string is returned.</p>
|
|
</section>
|
|
<hr>
|
|
<section>
|
|
<h1>Examples</h1>
|
|
</section>
|
|
<section>
|
|
<h2>Importing a JavaScript source file</h2>
|
|
<p>In this example we're importing a JavaScript source file from <code>/public/assets/js/script.js</code> relative from <a href="/docs/v3.1.5/Reference/Env#root_path"><code>root_path</code></a>.</p>
|
|
</section>
|
|
<section>
|
|
<?= VV::include("snippets/HTMLCodeDemoElement/HTMLCodeDemoElement?id=docs/v3.1.5/PHP/VV/js/example_import") ?>
|
|
</section>
|
|
</main>
|