Importing snippets

Importing snippets is the main usage for any page rendering system, below is the file that generates the home page (index.html)

<!doctype html>
<html>
{import src/imports/head.templar}
<body>

{import src/imports/header.templar}

<section id="main">
	<div class="container">
		<div class="row 200%">
			<div class="4u 12u$(medium)">
				{import src/imports/sidebar.templar}
			</div>

			<div class="8u$ 12u$(medium) important(medium)">

				<section id="content">
					{import src/imports/content/index.html}
				</section>

			</div>
		</div>
	</div>
</section>

{static ../synapticloop.github.io/src/includes/footer.html}

{static ../synapticloop.github.io/src/includes/scripts.html}
</body>
</html>

Note that there are both import and static declarations in the file and that the file locations do not always reside in the project directory.

{import <file_location>}

All locations are relative to the base directory. I.e. the directory from which the templar-gen is invoked.

This will import the file as designated in the file_location, which will also parse the files for templar functions and processing instructions.

This means that you are able to output any context items in the file. If you are including a file with the templar delimiter (i.e. {) you will need to escape it as {{.

{static <file_location>}

All locations are relative to the base directory. I.e. the directory from which the templar-gen is invoked.

Should you wish to include the file verbatim - i.e. without any templar parsing of directives - then the {static} declaration is what is required.