gulp-file-include
gulp-file-include copied to clipboard
Partial inside a partial - get page variables
Hi,
If my header.tpl.html
contains:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>@@if (context.title) {@@title - }Buoy, The DigitalOcean UI Kit</title>
<link rel="stylesheet" href="./assets/css/buoy.css">
<link rel="stylesheet" href="./docs/assets/css/docs.css">
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
</head>
<body>
@@include('../partials/nav.tpl.html')
That has a nav partial that contains:
<ul class="SideNav-list">
<li><a @@if (context.title === 'Alerts') { class="is-active" } href="alerts.html">Alerts</a></li>
<li><a @@if (context.title === 'Badge') { class="is-active" } href="badge.html">Badge</a></li>
</ul>
That is then finally included like so on a page:
@@include('../partials/header.tpl.html', {
"title": "Alerts"
})
<h1>Alerts</h1>
Then the page that includes header.tpl.html
is not actually checking for the page var, because I suspect it's looking for header.tpl.html
to set the context. Any tips on a way around this?