# Include

With the `include` directive you can include the contents of another file inside your template. The contents of the included file will be treated as if the contents of that file were written in place of its `include` directive.

{% hint style="info" %}
You can only write `include` directives where you could also write HTML. This means, `include` directives are not allowed in the following contexts:

* Before the `func` directive in main files
* Inside the body of a mixin call, if not inside one of the mixins `block`s
  {% endhint %}

Depending on the included file's file extension, corgi will treat included files differently:

* `.corgi`: The file will be treated as corgi code, and will be parsed by the parser.
* `.html`, `.js`, or `.css`: The file will be minified and included in the output.
* Any other file will be escaped using `woof.EscapeHTMLBody` and written to the output.

{% hint style="info" %}
If you don't want the behavior described above, but cannot/don't want to change the file's extension, consider using `cat` as a filter:

```pug
:cat myfile.js
```

{% endhint %}

Included `.corgi`-files may also `import` and `use` other files.

{% code title="style.css" %}

```css
.yellow {
  color: yellow;
}
```

{% endcode %}

{% code title="nacho.corgi" %}

```pug
p Do you know how hard it is to get cheese out of fur in a sonic shower?!
```

{% endcode %}

{% tabs %}
{% tab title="Corgi" %}

```pug
head
  style
    include "style.css"




body
  include "nacho.corgi"



```

{% endtab %}

{% tab title="HTML" %}

```markup
<head>
  <style>
    .yellow {
      color: yellow;
    }
  </style>
</head>
<body>
  <p>
    Do you know how hard it is to get cheese out of fur in a sonic shower?!
  </p>
</body>
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mavolin.gitbook.io/corgi/learning-corgi/include.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
