Jump to content

Recommended Posts

Posted

Hi 

Which CSS frameworks works best with PageGrid and are used together? What are you experiences concerning page speed?

Posted

PAGEGRID makes no assumptions about CSS or markup. This means that all CSS frameworks also work with PAGEGRID.

I don't work with CSS frameworks myself, so I can't really recommend any (I prefer to use modern vanilla CSS like variables, grid, etc.). But I think it's totally fine to use them. I don't think it will have big impact on performance (depending on how large the CSS file for the framework is), just make sure to load your CSS fraemwork files inside the <head> tag so it's not blocking the rendering of your page.

There are basically two approaches to working with PAGEGRID, but these can also be combined:

  • No-code approach: You can create entire websites with PAGEGRID without writing any code yourself. To do this, you can use the “Ready-Made Blocks” and create CSS classes and styles with the Style Panel. This works similarly to Webflow or Figma and is particularly interesting for people who want to customize their website visually (which can be faster then doing it in code).
  • Code only: If you prefer to work in code, you can disable the Style Panel in the PAGEGRID settings (Setup > PAGEGRID). You can then use any CSS framework with PAGEGRID. If you want to use your own CSS code or a framework, you can load it into your page template (take a look at the pagegrid-page.php template as an example). If you want to create your own blocks, you can copy the ready-made blocks from “site/modules/PageGridBlocks/blocks” to your “site/templates/blocks” folder and customize the markup there (e.g., add classes and markup for your CSS framework), or create your blocks from scratch. Learn more here: How do I create my own blocks? or here: how styles work in PAGEGRID.

Here is an example of an accordion block using the UIkit framework as an example:

<?php namespace ProcessWire; ?>

<!-- UIkit accordion block using PAGEGRID's children option -->
<ul uk-accordion pg-children="true" pg-children-label="Accordion Items" pg-children-tab="append" pg-autotitle="false" pg-wrapper>
    <?php foreach ($page->children() as $item) : ?>
	<li>
  		<a class="uk-accordion-title" href><?= $item->title ?></a>
    	<div class="uk-accordion-content"><?= $pagegrid->renderItem($item) ?></div>
	</li>
    <?php endforeach ?>
</ul>

In this example we use PAGEGRID's children option to render the accordion items (as child pages). Users can then add child items using the backend editor. You could also use repeaters to render the child items for PAGEGRID. The point here is that you can easily add whatever markup is neede for your CSS framework by creating your own custom blocks.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...