(Vegvisir 2, Vegvisir 3)
VV::js()
Import and minify a JavaScript file.
The syntax is identical to VV::css()
, and VV::embed()
.
VV::js()
imports and minifies a JavaScript file and returns it as a string.
pathname
Path to a JavaScript file to import relative from project root.
relative
Path provided to pathname
will be a relative when this parameter is true
(default). Set to false
to make path absolute.
string
A string containing minified JavaScript. Please note that linebreaks are preserved.
Will return an empty string if the path provided to pathname
is not a valid JavaScript file, or if it failed to import.
Let's take the following JavaScript file and put it into a page.
= Snippet::put("docs/API/PHP/VV/js/example-1-0", Snippet::JAVASCRIPT) ?> = Snippet::put("docs/API/PHP/VV/js/example-1-1", Snippet::PHP) ?>By using VV::js()
inside a script
, we've enabled the code for that specific page.