Skip to content
● Meet Grav Guard: keep every Grav site you run secure and up to date, all from one place. Free for up to 3 sites. Read more →

CSS Reset needed or not?

Started by Why Doyouneedit 9 years ago · 4 replies · 1236 views
9 years ago

Hi,

Is there a CSS reset implemented in GRAV ?

I was thinking about adding normalize.css to my stylesheets, and was wondering how to add it before any GRAV stylsheets loaded with assets.css.

9 years ago

Hi
If you want to add in your own css to a theme you can do it by updating the partial base.html.twig with the location of the new css file. This is an example from the antimatter theme.

TWIG
{% block stylesheets %}
    {% do assets.addCss('theme://css/normalize.css', 10) %}
    {% do assets.addCss('theme://css/pure-0.5.0/grids-min.css', 103) %}
    {% do assets.addCss('theme://css-compiled/nucleus.css', 102) %}
    {% do assets.addCss('theme://css-compiled/template.css', 101) %}
    {% do assets.addCss('theme://css/custom.css', 100) %}
    {% do assets.addCss('theme://css/font-awesome.min.css', 100) %}
    {% do assets.addCss('theme://css/slidebars.min.css') %}
    ...

I assume you'd want normalize to be one of the first things that loads so I've set the priority to 10 (the default) but you can you easily adjust the loading order by adjusting that number. There's more information about loading assets here: https://learn.getgrav.org/themes/asset-manager#assets-in-themes

9 years ago

Thanks @csixtyfour, but the question was more "Is there a CSS reset implemented in GRAV" than "how to implement it". Thanks anyway, for the informations. I guess that I can simply add a Reset in first position, and all will be fine.

9 years ago

Ah ok in that sense Grav base doesn't add any css by default (plugins might) as that stuff is really for the theme level so adding your own won't cause any conflicts.

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by themetman, 6 days ago
1 103 2 days ago
Themes & Styling · by AH, 3 weeks ago
1 223 3 days ago
Themes & Styling · by Bruno, 4 years ago
6 1386 3 days ago
Themes & Styling · by TomW, 3 weeks ago
2 227 5 days ago
Themes & Styling · by FrViPofm, 2 months ago
4 687 2 months ago