SproutCMS

This is the code documentation for the SproutCMS project

function js()

ECHOs one or more <script> tags referring to specified JS files.
Uses variable arguments, one per css file.
The URLs will contain embedded timestamps, making them auto-versioned

Usage example:
  <?php Skin::js('site', 'home'); ?>

Optionally provide an array to specify attributes, like so:
  <?php Skin::js('site', 'home', ['crossorigin' => 'anonymous', 'defer' => '']); ?>
Will return:
  <script src="skin-ts/skin/js/site.js" crossorigin="anonymous" defer=""></script>
  <script src="skin-ts/skin/js/home.js" crossorigin="anonymous" defer=""></script>

There isn't a guarantee that multiple tags will be ECHOed, but the order will always remain as specified.
If you need more control use the helper `js_url` and echo the tags yourself.

Usage

void Skin::js ( );

Return value

  • void