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

Theme Development or Port from HTML

Started by Muut Archive 9 years ago · 2 replies · 569 views
9 years ago

Hi Grav community,

I'm a front-end coder and new to Grav. I'm trying to build my own theme for Grav but I can't understand fully to do it.

I want to build theme consist of a blog page, home, and other pages. I can build those in HTML5 using frameworks like foundation or bootstrap but I can't figure out how to port it as Grav theme.

If you can point me to any details tutorial it will be a big help. I have tried to read the documentation but it was too complex for me.

Thanks.

9 years ago

It's really a very simple process to port themes to Grav. I have done quite a few myself.

Basically start by creating a new base theme. I suggest using devtools plugin to get started (use "pure-blank") example:

BASH
bin/gpm install devtools
bin/plugin devtools newtheme

Fill in the info for the name of your theme, etc.

Once you have this new theme, set it as default in the /user/config/system.yaml file.

The "pure-blank" theme, uses a very basic layout with the Pure CSS framework.

The meat of the theme is contained in templates/partials/base.html.twig. Tweak this to mimic the theme you are porting. Just keep the same kinds of block and also use the Grav assets paths. Make sure you copy the original theme's CSS and JS and stuff into proper locations.

The templates/ folder contains the page templates, but these should generally extend base, and then just override certain blocks where needed.

Some tips:

1) Read the Twig Docs for designers: http://twig.sensiolabs.org/doc/1.x/templates.html
2) Use Antimatter theme (probably already installed) for helpful references.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1336 9 years ago
Archive · by Muut Archive, 9 years ago
2 926 9 years ago
Archive · by Muut Archive, 9 years ago
2 4056 9 years ago
Archive · by Muut Archive, 9 years ago
1 2941 9 years ago
Archive · by Muut Archive, 9 years ago
3 1112 9 years ago