Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

CSS Reset needed or not?

Started by Why Doyouneedit 8 years ago · 4 replies · 858 views
8 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.

8 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

8 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.

8 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 Pedro M, 2 months ago
4 192 2 months ago
Themes & Styling · by Ian, 2 months ago
3 89 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 447 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 42 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 122 3 months ago