---
title: 'How to add css to Twig templates'
url: 'https://getgrav.org/forum/themes-styling/how-to-add-css-to-twig-templates-t6416'
markdown: 'https://getgrav.org/forum/themes-styling/how-to-add-css-to-twig-templates-t6416.md'
date: '2026-06-21'
description: 'I would like to understand how should I include the following HTML syntax in a Twig template (custom theme): < ! - - [if lt IE 9]> < script'
---

[Themes & Styling](https://getgrav.org/forum/themes-styling)

#   How to add css to Twig templates 

 Solved by Dimitri Longo [View solution](https://getgrav.org/forum/themes-styling/how-to-add-css-to-twig-templates-t6416#post-19682)

  Started by Usk70 9 years ago · 1 replies · 6040 views    

 [9 years ago](https://getgrav.org/forum/themes-styling/how-to-add-css-to-twig-templates-t6416#post-19680 "Permalink") 

I would like to understand how should I include the following HTML syntax in a Twig template (custom theme):

> < ! - - \[if lt IE 9\]> < script type="text/javascript" src="js/customFoo.js" > < / script > < ! \[endif\] - - >

 [9 years ago](https://getgrav.org/forum/themes-styling/how-to-add-css-to-twig-templates-t6416#post-19682 "Permalink")  Solution 

many ways to add assets

<https://learn.getgrav.org/themes/asset-manager#example>

in `base.html.twig` for example

[See Antimatter base.html.twig](https://github.com/getgrav/grav-theme-antimatter/blob/7cf506dfe829f3d0a2b24f4dc249fa747c3bf08f/templates/partials/base.html.twig#L24-L27)

or with assets plugin

<https://github.com/getgrav/grav-plugin-assets>

[Log in](https://getgrav.org/login?return=%2Fforum%2Fthemes-styling%2Fhow-to-add-css-to-twig-templates-t6416) to reply.

###  Suggested topics

 | Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| [Grav2 with Quark2 – All pages in the hamburger-menu of a one-pager](https://getgrav.org/forum/themes-styling/grav2-with-quark2-all-pages-in-the-hamburger-menu-of-a-one-pager-t9485)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by AH, 2 weeks ago |  | 1 | 198 | [9 hours ago](https://getgrav.org/forum/themes-styling/grav2-with-quark2-all-pages-in-the-hamburger-menu-of-a-one-pager-t9485 "by AH") |
| [\[quark\] mobile menu as the modular page menu](https://getgrav.org/forum/themes-styling/quark-mobile-menu-as-the-modular-page-menu-t1132)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by Bruno, 4 years ago |  | 6 | 1350 | [9 hours ago](https://getgrav.org/forum/themes-styling/quark-mobile-menu-as-the-modular-page-menu-t1132 "by AH") |
| [Modular Page Background Image Display](https://getgrav.org/forum/themes-styling/modular-page-background-image-display-t9486)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by TomW, 2 weeks ago |  | 2 | 203 | [2 days ago](https://getgrav.org/forum/themes-styling/modular-page-background-image-display-t9486 "by TomW") |
| [Inheriting a Theme does not quite work correctly](https://getgrav.org/forum/themes-styling/inheriting-a-theme-does-not-quite-work-correctly-t9501)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by themetman, 3 days ago |  | 0 | 56 | [3 days ago](https://getgrav.org/forum/themes-styling/inheriting-a-theme-does-not-quite-work-correctly-t9501 "by themetman") |
| [Is it a way to get the "content - summary" in a twig template ?](https://getgrav.org/forum/themes-styling/is-it-a-way-to-get-the-content-summary-in-a-twig-template-t9431)    [Themes & Styling](https://getgrav.org/forum/themes-styling) · by FrViPofm, 2 months ago |  | 4 | 668 | [1 month ago](https://getgrav.org/forum/themes-styling/is-it-a-way-to-get-the-content-summary-in-a-twig-template-t9431 "by Paul Hibbitts") |
