<p>When you want to output Twig variables inside another Twig tag, you shouldn't include the braces around the variable.</p>

<p>So this:</p>

<pre><code>{% includeCssFile "{{ siteUrl }}css/modul.min.css" %}
{% includeJsFile "{{ siteUrl }}js/ui.min.js" %}
</code></pre>

<p>Should be this:</p>

<pre><code>{% includeCssFile siteUrl ~ "css/modul.min.css" %}
{% includeJsFile siteUrl ~ "js/ui.min.js" %}
</code></pre>

<p>These examples use the <a href="http://twig.sensiolabs.org/doc/2.x/templates.html#other-operators" rel="nofollow noreferrer">concatenation operator</a> (<code>~</code>) to join the value held in the <code>siteUrl</code> variable to the string holding the path to the CSS or JS file to be included.</p>

CC BY-SA 3.0
2017-02-13T15:37:31.553Z
2017-02-13T15:37:31.553Z
Steve Rowling
<p>It seems that when calling a CSS or JS file include, if the path contains {{ siteUrl }} it outputs {{ siteUrl }} in the html that is generated.</p>

<p>Like so;
<code>&lt;link rel="stylesheet" type="text/css" href="{{ siteUrl }}css/styles.css"/&gt;</code></p>

<p>Which should be (for example);
<code>&lt;link rel="stylesheet" type="text/css" href="http://site.url/dev/css/styles.css"/&gt;</code></p>

<p>Anything I'm missing here?</p>

CC BY-SA 3.0
2017-01-29T01:03:50.173Z
never had that happening to me, are you sure you don't have quotes around your siteUrl so it's just a string? like this: {{'siteUrl'}}? Either way, I don't it's necessary to add your full url to your assets paths. You can just point to them like href="/css/styles.css"
Jan_dh
CC BY-SA 3.0
2017-01-29T18:10:13.210Z
Can you provide the code you use for `includeCssFile` and `includeJsFile`?
Aaron Berkowitz
CC BY-SA 3.0
2017-01-30T04:44:40.593Z
This is the code; `{% includeCssFile "{{ siteUrl }}css/modul.min.css" %}` and `{% includeJsFile "{{ siteUrl }}js/ui.min.js" %}`
Anders
<templating>
includeCssFile and includeJsFile doesn't output {{ siteUrl }}
# includeCssFile and includeJsFile doesn't output {{ siteUrl }}

(Asked by: username_0 on 2017-01-28)

It seems that when calling a CSS or JS file include, if the path contains {{ siteUrl }} it outputs {{ siteUrl }} in the html that is generated.

Like so;

Which should be (for example);

Anything I'm missing here?

**Tags:** templating

> **Comments:**
> **username_1**: never had that happening to me, are you sure you don't have quotes around your siteUrl so it's just a string? like this: {{'siteUrl'}}? Either way, I don't it's necessary to add your full url to your assets paths. You can just point to them like href="/css/styles.css"  
> **username_2**: Can you provide the code you use for `includeCssFile` and `includeJsFile`?  
> **username_0**: This is the code; `{% includeCssFile "{{ siteUrl }}css/modul.min.css" %}` and `{% includeJsFile "{{ siteUrl }}js/ui.min.js" %}`  

---

## 1 answers

### Answer by username_3 on 2017-02-13. Score: 3 | Accepted answer

When you want to output Twig variables inside another Twig tag, you shouldn't include the braces around the variable.
So this:
{% includeCssFile "{{ siteUrl }}css/modul.min.css" %}
{% includeJsFile "{{ siteUrl }}js/ui.min.js" %}

Should be this:
{% includeCssFile siteUrl ~ "css/modul.min.css" %}
{% includeJsFile siteUrl ~ "js/ui.min.js" %}

These examples use the concatenation operator (~) to join the value held in the siteUrl variable to the string holding the path to the CSS or JS file to be included.


---

