title: Include a twig template as an object to be passed into another template?
body: <p>Im using gulp-twig: <a href="https://github.com/zimmen/gulp-twig">https://github.com/zimmen/gulp-twig</a> </p>
  
  <p>I have a twig file for my container component:</p>
  
  <pre><code>{# container.twig #}
  &lt;div class="container"&gt;
    {% for item in items %}
      &lt;div class="container__item"&gt;
  
        {{ item }}
  
      &lt;/div&gt;
    {% endfor %}
  &lt;/div&gt;
  </code></pre>
  
  <p>I also have a snippet file: </p>
  
  <pre><code>{# snippet.twig #}
  &lt;div class="snippet"&gt;
    &lt;h2&gt;{{ title }}&lt;/h2&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Im demoing these in page.twig. I need to render the snippet as the {{ item }} within the container. So when viewing page.twig this should be the output: </p>
  
  <pre><code>&lt;div class="container"&gt;
      &lt;div class="container__item"&gt;
  
        &lt;div class="snippet"&gt;
          &lt;h2&gt;title&lt;/h2&gt;
        &lt;/div&gt;
  
     &lt;/div&gt;
     &lt;div class="container__item"&gt;
  
       &lt;div class="snippet"&gt;
         &lt;h2&gt;title&lt;/h2&gt;
       &lt;/div&gt;
  
     &lt;/div&gt;
     &lt;div class="container__item"&gt;
  
       &lt;div class="snippet"&gt;
         &lt;h2&gt;title&lt;/h2&gt;
       &lt;/div&gt;
  
     &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Now here is where it gets tricky. container.twig and snippet.twig are being pulled into another application. As such {{ item }} within container.twig cant be changed to something like {{ itemRenderer(item) }}.</p>
  
  <p>However page.twig is not being used anywhere else so I can edit it however I like. Is there a way in page.twig to render container.twig with snippet.twig as it's item, without modifying container.twig or snippet.twig? </p>
  
  <p>This is my gulp task: </p>
  
  <pre><code>var gulp    = require('gulp'),
    config    = require('../config'),
    utilities     = require('../build-utilities'),
    src       = config.path.src,
    dest      = config.path.dest,
    opts      = config.pluginOptions,
    env       = utils.getEnv(),
    plugins   = require('gulp-load-plugins')(opts.load);
  
  var compile = function() {
    var notProdOrTest = env.deploy &amp;&amp; !env.prod &amp;&amp; !env.test,
      deployPath    = env.deployPath,
      sources = (env.deploy) ? ((env.styleguide) ? src.twig.styleguide: src.twig.testing): src.twig.all;
    return gulp.src(sources, {base: 'src/'})
      .pipe(plugins.twig({
        data: {
          component: utils.getDirectories('src/component/'),
          deploy    : env.deploy,
          test      : env.test,
          prod      : env.prod
        }
      }))
      .pipe(plugins.htmlmin(opts.htmlmin))
      .pipe(plugins.tap(function(file){
        file.path = file.path.replace('testing/', '');
      }))
      .pipe((notProdOrTest) ? plugins.replace(/src="\//g, 'src="/' + deployPath.root + '/'): plugins.gutil.noop())
      .pipe((notProdOrTest) ? plugins.replace(/href="\//g, 'href="/' + deployPath.root + '/'): plugins.gutil.noop())
      .pipe((notProdOrTest) ? plugins.replace(/srcset="\//g, 'srcset="/' + deployPath.root + '/'): plugins.gutil.noop())
      .pipe((notProdOrTest) ? plugins.replace(/url\('\//g, 'url(\'/' + deployPath.root + '/'): plugins.gutil.noop())
      .pipe(gulp.dest((env.deploy) ? deployPath.markup: dest.markup));
  },
    watch = function() {
      gulp.watch(src.twig.watch, ['twig:compile']);
    };
  
  module.exports = {
    compile: compile,
    watch  : watch
  };
  </code></pre>