fn: jsinclude
[contents]

Contents

Syntax

The syntax for jsinclude calls is:

f++:  
jsinclude{options}(absolute-path)

n++:  
@jsinclude{options}(absolute-path)

Description

The jsinclude function takes a single absolute path as input and returns the code below to insert the path as a javascript file in html using the relative path:

<script src="relative-path" options></script>

The jsinclude function also throws a warning if the javascript file does not exist.

Note: Another good way to include a javascript file, where an error is thrown if the file does not exist, is:

<script src="@pathtofile(absolute-path)"></script>

Options

Anything added as an option to a jsinclude call will be added to the code to insert the path as a javascript file as outlined in the Description section.

f++ example

Example of jsinclude being used with f++:

jsinclude("site/assets/js/jquery.min.js")

n++ example

Example of jsinclude being used with n++:

@jsinclude("site/assets/js/jquery.min.js")