title: How to use here() for paths to css, before_body and after_body?
body: <p>I have a collection of RMarkdown documents which are distributed over a hierarchy of folders. All of the documents refer to the same CSS and header/footer files. I have the paths to these files hard-coded at present but this is difficult to maintain. I'd prefer to generate the path dynamically.</p>
  
  <p>This works (the date is generated dynamically in code):</p>
  
  <pre><code>---
  title: "Untitled"
  date: "`r Sys.Date()`"
  output: html_document
  ---
  </code></pre>
  
  <p>But this does not work:</p>
  
  <pre><code>---
  title: "Untitled"
  date: "`r Sys.Date()`"
  output: 
    html_document:
      css: '`r here::here("styles/styles.css")`'
      includes:
        before_body: '`r here::here("styles/header.html")`'
        after_body: '`r here::here("styles/footer.html")`'
  ---
  </code></pre>
  
  <p>The files <code>styles.css</code>, <code>header.html</code> and <code>footer.html</code> are all located in the <code>styles/</code> folder off the root of the project. When I refer to these files using <code>here::here()</code> from the console it works perfectly.</p>
  
  <p>However, when I compile the RMarkdown I get errors like this:</p>
  
  <pre><code>File `r here::here( not found in resource path
  Error: pandoc document conversion failed with error 99
  </code></pre>
  
  <p>The above error relates to the CSS file. And then for the header and footer:</p>
  
  <pre><code>pandoc: `r here::here("styles/header.html")`: openBinaryFile: does not exist
  (No such file or directory)
  </code></pre>
  
  <p>The fact that this code is getting as far as Pandoc suggests to me that the code chunks are not being evaluated.</p>
  
  <p>Am I doing something silly? Is this the expected behaviour? It seems to me that it would be very helpful to be able to generate the paths dynamically.</p>