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

slab.css

v1.1.3

Published

CSS toolkit based on Inuit.css/ITCSS

Downloads

83

Readme

Slab.css

Slab.css it a lightweight CSS toolkit based on Inuit.css/ITCSS.

Getting started

Install Slab.css via yarn or bower and include in you main scss file as follows:

@import "path/to/slab/tools";
@import "vars"; // Your variable overrides go here
@import "path/to/slab/index";

@import "path/to/slab/plugins";
// Your application styles go here

As your variable overrides can potentially use values specified in the various data maps, the functions to access these data maps need to be added first.

Settings

Slab.css handles 3 aspects of your application; breakpoints, colours and spacing. Each of these provide variables that can be overridden to suit application's design.

Responsive

Slab.css manages its breakpoints and responsive helper classes via a sass data map $breakpoints. The data map allows you to set a media query and give it a name allowing it to be referenced easier throughout your application.

$breakpoints: (
    palm: '(max-width: 767px)',
    lap: '(min-width: 768px) and (max-width: 1023px)',
    portable: '(max-width: 1023px)',
    lap-and-up: '(min-width: 768px)',
    desk: '(min-width: 1024px)',
    desk-wide: '(min-width: 1440px)'
) !default;

The defaults shown above are accessed via the media-query sass mixin:

.box {
    padding-top: 1rem;

    @include media-query(lap-and-up) {
        padding-top: 2rem;
    }

    @include media-query(desk-wide) {
        font-size: 1.5rem;
    }
}

Colours

Managing colours in Slab.css is done via a sass data map named $palette. The map allows for nicer management than standard sass variables and also creates helper classes to apply text and background colours to any element. Each colour added must have a tone named base at a minimum.

Create map:

$palette: (
    'grey': (
        'base': #999,
        'light': lighten(#999, 25%),
        'dark': #333
    ),
    'red': (
        'base': #F00
    ),
);

Access to the map is via the getColour mixin.

.box {
    background-color: getColour('red'); // 'base' is default
    color: getColour('grey', 'dark');
}

A set of utility classes are also generated.

<div class="bg--grey-light text--red"></div>

Spacing

Slab.css allows for the creation of utility classes and sass variables to help with spacing. A data map is used to create references to spacing values of your choosing. By default the data map contains:

$spacing: (
    'small': 0.75rem,
    'medium': 1.5rem,
    'large': 3rem
) !default;

From these values, responsive utility classes are created for both margin and padding in the format `{namespace}-{margin/padding}{direction}-{data map key}’.

If we assume 1rem is 16px, then:

.m-small  // margin: 12px;
.ml-none // margin-left: 0;
.px-medium // padding-left: 24px; padding-right: 24px;
.py-large // padding-top: 48px; padding-bottom: 48px;

// Responsive utility classes
.portable-mb-none // margin-bottom: 0; on portable breakpoint
.desk-wide-p-medium // padding: 24px; on desk-wide breakpoint

Note: Each value in the spacing data map can produce a large amount of css. If a value is not used in your application it is recommended to overwrite the data map in your _vars.scss with the appropriate values to reduce file size. Or alternatively if your application does not make use of the responsive utility classes you can switch them off via the $slab-responsive-spacing boolean variable.

Visibility

Responsive visibility helper classes are available to hide/show content based on breakpoints.

.hide-palm // hide on palm breakpoint
.show-lap-and-up // show on lap-and-up breakpoint