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

@jogarcia/mgrid

v1.0.2

Published

A simple container class based on Bootstrap's container class

Downloads

15

Readme

Grid System

This grid system is inspired by Bootstrap's layout system but utilizes CSS Grid. It is built with 12 columns, which can be spanned in various ways to create flexible layouts.

This module contains files that are fully modular. I don't offer a full bundle. So, if you want all the files you'll have to import them yourself.

How to import

In a js file:

import "@jogarcia/mgrid/container.scss";
import "@jogarcia/mgrid/g-row.scss";
import "@jogarcia/mgrid/g-col.scss";
import "@jogarcia/mgrid/gap.scss";
import "@jogarcia/mgrid/margin.scss";
import "@jogarcia/mgrid/padding.scss";

or

import "@jogarcia/mgrid/dist/container.css";
import "@jogarcia/mgrid/dist/g-row.css";
import "@jogarcia/mgrid/dist/g-col.css";
import "@jogarcia/mgrid/dist/gap.css";
import "@jogarcia/mgrid/dist/margin.css";
import "@jogarcia/mgrid/dist/padding.css";

In a scss/sass file:

@import "~@jogarcia/mgrid/container.scss";
@import "~@jogarcia/mgrid/g-row.scss";
@import "~@jogarcia/mgrid/g-col.scss";
@import "~@jogarcia/mgrid/gap.scss";
@import "~@jogarcia/mgrid/margin.scss";
@import "~@jogarcia/mgrid/padding.scss";

or

@import "~@jogarcia/mgrid/dist/container.css";
@import "~@jogarcia/mgrid/dist/g-row.css";
@import "~@jogarcia/mgrid/dist/g-col.css";
@import "~@jogarcia/mgrid/dist/gap.css";
@import "~@jogarcia/mgrid/dist/margin.css";
@import "~@jogarcia/mgrid/dist/padding.css";

Classes

  • .container: Diminishes the spacing around the tag that its applied to.
  • .g-row: Use this class for a grid row. It creates a grid layout context and contains 12 grid columns.
  • .g-col-{number}: Spans {number} columns on from 0px on.
  • .g-col-{breakpoint}-{number}: Spans {number} columns on from {breakpoint} on.
  • .gap-{number}: Adds a gap with value {number}, uses the rem measure unit by default.
  • .m-{number}: Adds margin in all directions. Uses the em measure unit by default.
  • .m{direction}-{number}: Adds margin in the {direction} given.
  • .p-{number}: Adds padding in all directions. Uses the em measure unit by default.
  • .p{direction}-{number}: Adds padding in the {direction} given.

If you have used before most styles libraries you must be used to breakpoints. These are the default breakpoints of this library.

  • xs: >= 0px
  • sm: >= 576px
  • md: >= 768px
  • lg: >= 992px
  • xl: >= 1200px
  • 2xl:>= 1400px

Directions specified:

  • t = top
  • b = bottom
  • l = left
  • r = right
  • x = right and left
  • y = top and bottom
  • If no specification = all the dimensions at the same time

Customization

All the files posses customization options that can be changed at import. This section defines each.

Container

You can change the breakpoints of the container by passing them like this:

@use "~@jogarcia/mgrid/container.scss" with (
  $breakpoints: (
    "xs": (
      "min": 0px,
      "width": 100%,
    ),
    "sm": (
      "min": 576px,
      "width": 100%,
    ),
  )
);

Row

Row does not have customization options

Col

Similar to the container you can change the col breakpoints passing them like this:

@use "~@jogarcia/mgrid/g-col.scss" with (
  $breakpoints: (
    "xs": 0px,
    "sm": 476px,
    "md": 668px,
    "lg": 792px,
  )
);

Gap, margin and padding

You can personalize the following variables in these 3:

  • range. Defines how much classes there will be
  • base. Allows you to multiply each iteration by this number. By default 1 for gap and 0.25 for margin and padding.
  • unit. You can set your preferred unit. For gap I use rem while for margin and padding I use em.

An example with gap:

@use "~@jogarcia/mgrid/gap.scss" with (
  $base: 1,
  $range: 20,
  $unit: px
);

This will create gap classes from 0 to 20 using the pixels unit and multiplying each iteration with 1.