Version: v0.7.1 - Beta.  We welcome contributors & feedback.

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:

$page.addJs(url'assets/app.js')

$page.addJs(fancyScrollJs())

tm 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.

See Also