CSS Reset needed or not?


#1

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.


#2

Up … Is it an absurd question ? ^^


#3

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.

{% 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


#4

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.


#5

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.