title: How to pass variables to parent parent template
body: <p>I'm trying to design the structor for a page with multiple level of nesting, some thing like:</p>
  
  <pre><code>[base-template]
  
        ||
        \/
  
  [layout-template]
  
        ||
        \/
  
  [page-template]
  </code></pre>
  
  <p>base-template is the master template which I used to implement the skeleton of a page, and I have some layout specific html which is implemented in layout-template. (each layout has some JavaScript and CSS files) 
  Then in each page I import a proper layout and again each page has its own CSS and JavaScript files.</p>
  
  <p>I need to set required css/js file in each layout and page and base template should add css files to the head and js files to the body. I'm trying to accomplish this by using macros but can not get what I need.</p>
  
  <p>Here is the example that explains the use case:</p>
  
  <p><strong>[base-template]</strong></p>
  
  <pre><code>&lt;#macro skeleton&gt;
    &lt;!DOCTYPE html&gt;
      ...
      ...css files...
      &lt;get some more css&gt;
      ...
      &lt;#nested&gt;
      ...js files...
      &lt;get some more js&gt;
    &lt;/html&gt;
  &lt;/#macro&gt;
  </code></pre>
  
  <p><strong>[layout-template]</strong></p>
  
  <pre><code>&lt;#import "base.ftl" as template&gt;
  &lt;set some more css for layout&gt;
  &lt;set some more js for layout&gt;
  &lt;#macro layout&gt;
    &lt;@template.skeleton&gt;
      &lt;div&gt;
        ... some html in layout ...
        &lt;#nested&gt;
        ... some html in layout ...
      &lt;/div&gt;
    &lt;/@template.skeleton&gt;
  &lt;/#macro&gt;
  </code></pre>
  
  <p><strong>[page-template]</strong></p>
  
  <pre><code>&lt;#import "layout.ftl" as template&gt;
  &lt;set some more css for page&gt;
  &lt;set some more js for page&gt;
  &lt;#macro layout&gt;
    &lt;@template.layout&gt;
      &lt;div&gt;
        ... some html for a page ...
      &lt;/div&gt;
    &lt;/@template.layout&gt;
  &lt;/#macro&gt;
  </code></pre>
  
  <p>I appreciate any helps and feedbacks.</p>