Answers.Body: <p>The problem with putting them in your <code>templates</code> folder is now PHP/Craft is going to try and serve them.  Meaning that you've got the overhead of PHP and Craft when trying to request every single asset instead of if they were in the <code>public</code> folder where Apache can instantly serve them (orders of magnitude faster).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-12T19:06:06.317Z
Answers.Text: Ok, I guess it should be directly handled by a reverse proxy, Nginx or other, to point the assets/ url to the assets folder in my Craft templates.
  
  Thanks !
Answers.UserDisplayName: Antoine
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-10T18:45:08.853Z
Answers.LastActivityDate: 2016-06-10T18:45:08.853Z
Answers.UserDisplayName: Brad Bell
Body: <p>I would like to let my static assets (JS, CSS and images file) close to my templates files.</p>
  
  <pre><code>public/
  templates/
      css/
      images/
      scripts/
      template.html
  </code></pre>
  
  <p>Until now, I didn't find a clean way to access these files.
  <code>{% includeCssFile %}</code> and <code>{% includeJsFile %}</code> works, but I get strange "compiling" issues with my javascript "templates" saying unclosed comment.</p>
  
  <p>Anyway, does a clean solution, other than copying these files to public, exists ? A variable like siteUrl pointing to the right folder ?</p>
  
Tags: <custom><files>
Title: Custom static assets
ThreadText: # Custom static assets
  
  (Asked by: username_0 on 2016-06-10)
  
  I would like to let my static assets (JS, CSS and images file) close to my templates files.
  
  ```
  public/
  templates/
      css/
      images/
      scripts/
      template.html
  
  ```
  
  Until now, I didn't find a clean way to access these files.
  `{% includeCssFile %}` and `{% includeJsFile %}` works, but I get strange "compiling" issues with my javascript "templates" saying unclosed comment.
  
  Anyway, does a clean solution, other than copying these files to public, exists ? A variable like siteUrl pointing to the right folder ?
  
  **Tags:** custom, files
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-06-10. Score: 2
  
  The problem with putting them in your `templates` folder is now PHP/Craft is going to try and serve them. Meaning that you've got the overhead of PHP and Craft when trying to request every single asset instead of if they were in the `public` folder where Apache can instantly serve them (orders of magnitude faster).
  
  > **Comments:**
  > **username_0**: Ok, I guess it should be directly handled by a reverse proxy, Nginx or other, to point the assets/ url to the assets folder in my Craft templates.  Thanks !  
  
  ---
  
  