fn: pathto
[contents]

Contents

Syntax

The syntax for pathto calls is:

f++:  
pathto{option}(string)

n++:  
@pathto{option}(string)

Description

The pathto function takes a single string parameter specifying either a tracked name or an absolute path to a file from the project root directory and returns the relative path from the file being built to either the output file for the tracked name specified by the parameter or the file specified by the input parameter.

Note: You can optionally specify whether the input parameter is for a file or name, see the Options section.

Options

The following options are available for pathto calls:

option description
file input parameter is an absolute path to a file from the project root directory
name input parameter is a tracked name
option description

n++ example

Examples of pathto being used with n++:

<a href="@pathto(index)">home</a>
<img src="@pathto('assets/images/logo.svg')">

<nav>
	<ul class="drop_menu">
		<li></li>
		<li class="dm_li">
			<a href="@pathto(index)">Home</a>
		</li>

		<li class ="dm_li">
			<div class="dm_text">Documentation</div>
			<ul class ="drop_submenu">
				<li class="dsm_li"><a href="@pathto(documentation/installing_nift)">Installing Nift</a></li>
				<li class="dsm_li"><a href="@pathto(documentation/nift_tutorial)">Nift tutorial</a></li>
				<li class="dsm_li"><a href="@pathto(documentation/nift_commands)">Nift commands</a></li>
			</ul>
		</li>

		<li class ="dm_li">
			<a href="@pathto(support)">Support</a>
		</li>
		<li></li>
	</ul>
</nav>