npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

include-media-grid

v1.2.0

Published

An include-media plugin for generating grid classes based on the flex display property

Downloads

9

Readme

include-media-grid

An include-media plugin for generating grid classes based on the flex display property

Introduction

This plugin generates classes for a grid system based on a number of subdivisions specified by the user, and taking into account all the breakpoints defined by include-media.


@import 'include-media';
@import 'include-media-grid';

$breakpoints: (phone: 480px, tablet: 768px, desktop: 1024px);

// Grid class name
$im-grid-class: 'grid';
// Cell class name
$im-grid-cell-class: 'grid-cell';
// Setting gutters
$im-grid-gutter-size: 20px;
// Optionally include max-width to fix IE issues
$im-grid-include-max-width: false !default;
// Generating grid classes for 1, 2 and 4 column layouts
@include im-grid-columns(1, 2, 4);

####Basic Grids: The grid cells below do not specify any widths, they just naturally space themselves equally and expand to fit the entire row. They’re also equal height by default.

<div class="grid">
  <div class="grid-cell">1/2</div>
  <div class="grid-cell">1/2</div>
</div>
<div class="grid">
  <div class="grid-cell">1/3</div>
  <div class="grid-cell">1/3</div>
  <div class="grid-cell">1/3</div>
</div>
<div class="grid grid--flex-cells">
  <div class="grid-cell">Full-height, even when my content doesn't fill the space.</div>
  <div class="grid-cell">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum mollis velit non gravida venenatis. Praesent consequat lectus purus, ut scelerisque velit condimentum eu. Maecenas sagittis ante ut turpis varius interdum. Quisque tellus ipsum, eleifend non ipsum id, suscipit ultricies neque.</div>
</div>

####Gutters

<!-- With gutters -->
<div class="grid grid--gutters">
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
</div>

####Individual Sizing When equal widths aren’t what you want, you can add sizing classes to individual cells. Cells without sizing classes simply divide up the remaining space as normal.

<!-- Force cell to be always a full width single column -->
<div class="grid" >
  <div class="grid-cell">auto - 1/2</div>
  <div class="grid-cell">auto - 1/2.</div>
  <div class="grid-cell grid-cell--1-1">Always single column!!!</div>
</div>

####Weight You can change the way the cells size themselves, by modifying flex-grow property.

<!-- With gutters -->
<div class="grid grid--gutters">
  <div class="grid-cell grid-cell--light">Half the weight of default column.</div>
  <div class="grid-cell"></div>
</div>
<!-- With gutters -->
<div class="grid grid--gutters">
  <div class="grid-cell grid-cell--heavy">Twice the weight of default column.</div>
  <div class="grid-cell"></div>
</div>

####Responsive Responsive Grids work by adding media classes to the Grid cells or containers. When those media values are met, the grids automatically adjust accordingly.

<!-- 1 column on mobile phones. 2 columns on tablets. 4 on desktop devices -->
<div class="grid grid--1-1@phone grid--1-2@tablet grid--1-4@desktop">
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
</div>

<!-- Full-width up to desktop breakpoint -->
<div class="grid grid--full grid--1-4@desktop">
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
  <div class="grid-cell grid-cell--1-1@dekstop"></div>
  <div class="grid-cell grid-cell--1-1">Always single column!!!</div>
</div>

<!-- Individual sizing -->
<div class="grid grid--1-1@phone grid--1-2@tablet grid--1-4@desktop">
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
  <div class="grid-cell grid-cell--1-1">Always single column!!!</div>
</div>

####Auto grids You can avoid adding grid-cell to children of the grid by using the grid--auto class. All children elements will be treated as a grid-cell.

<!-- No need for grid-cell  -->
<div class="grid grid--auto">
  <div>same row</div>
  <div>same row</div>
  <div>same row</div>
  <div>same row</div>
</div>

If you need your grid items to fit a specific number of columns, you can use grid--auto-{columnNumber}. Any column set generated with im-grid-columns is usable. Responsive grids are also usable.

<!-- No need for grid-cell, two columns per row  -->
<div class="grid grid--gutters grid--auto grid--auto-2@tablet grid--auto-4@desktop">
  <div>first row on desktop, first row on tablet</div>
  <div>first row on desktop, first row on tablet</div>
  <div>first row on desktop, second row on tablet</div>
  <div>first row on desktop, second row on tablet</div>
</div>

####Alignment Features

<!-- Top-aligned Grid Cells -->
<div class="grid grid--top">
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
</div>

<!-- Bottom-aligned Grid Cells -->
<div class="grid grid--top">
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
</div>

<!-- Vertically Centered Grid Cells -->
<div class="grid grid--center">
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
  <div class="grid-cell"></div>
</div>
<!-- Mixed Vertical Alignment -->
<div class="grid grid--top">
  <div class="grid-cell"></div>
  <div class="grid-cell grid-cell--center"></div>
  <div class="grid-cell grid-cell--bottom"></div>
</div>

More examples coming soon. See source files for more options.

It's recommended to use this plugin along with autoprefixer to maintain cross-browser [support] (http://caniuse.com/#feat=flexbox).

Requirements

Installation

  • Manually: Download this file and import it into your Sass project
  • npm: Run npm install include-media-grid
  • Bower: Run bower install include-media-grid

##Inspiration

Author

Tomasz Szarzynski