🖨️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.

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 blocks

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.

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:

:cat myfile.js

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

style.css
.yellow {
  color: yellow;
}
nacho.corgi
p Do you know how hard it is to get cheese out of fur in a sonic shower?!
head
  style
    include "style.css"




body
  include "nacho.corgi"


Last updated