Page.addJs
$page.addJs($urlOrJs) -> self
Description
Add a JavaScript asset to the <head>
of the document.
The first argument can be one of the following:
- A URL to an external script file.
- A TypeString that will be inlined in a
<script>
tag.
$page.addJs(url'assets/app.js') $page.addJs(fancyScrollJs()) tem fancyScrollJs { alert('Yuck. Don`t actually mess around with scrolling.') }
File Compression
Local CSS and JS URLs will automatically be minified and gzip compressed, saving up to 75% over the wire.
This can be changed with the compressAssets configuration.
It will also append a cache parameter with the file’s modify time (e.g. v=1245673424
) to support client-side caching.