<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>

CC BY-SA 3.0
2016-06-12T19:06:06.317Z
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 !
Antoine
CC BY-SA 3.0
2016-06-10T18:45:08.853Z
2016-06-10T18:45:08.853Z
Brad Bell
<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>

<custom><files>
Custom static assets
# 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 !  

---

