title: append HTML from file with Cheerio, NodeJs
body: <p>I am trying to append some html from a file to some existing html with cheerio but i keep getting errors (the errors are being produced by the cheerio library so debugging is hard)</p>
  
  <pre><code>expo.includeNav = function(html, result)
  {
      var file = 'templates/admin_nav.html';
  
      fs.readFile(file, function(err, nav)
      {
          var $ = cheerio.load(html);
          $('body').append(nav);
          result($.html());
  
      });
  
  }
  </code></pre>
  
  <p>It dosen't seem to like passing a variable into the append function.</p>
  
  <p>If i put the html in instead of calling from a file it works, like so: </p>
  
  <pre><code>$('body').append('&lt;div class="nav"&gt; navigation list here&lt;/div&gt;');
  </code></pre>
  
  <p>But i do not want that as i want front end devs to be able to edit an HTML file instead of digging into my node JS code to find where to change the html.</p>