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

bootstrap-breakpointify

v2.0.0

Published

Fight class creep by adding breakpoint suffixes to Bootstrap v4's utility classes.

Downloads

17

Readme

bootstrap-breakpointify

Fight "class creep" by adding breakpoint suffixes to Bootstrap v4's utility classes.

For example, .m-a-1-gt-md:

  • applies Bootstrap's "size 1" margin to all sides (the m-a-1 Bootstrap class)
  • at Bootstrap breakpoints greater than medium (gt-md).

Purpose

As a web project grows – and particularly as new contributors begin making changes to CSS – it's common for simple utilities to be used and re-used in dozens of ways. Without using "breakpointified" utilities, each usage tends to add both to the project weight and to the difficulty of grokking the entirety of the project's CSS.

Especially when "one-use" classes are repeatedly developed (eg: when a website contains multiple very unique landing pages), many projects tend to grow a base of "write-only CSS" (becuase editing "old" CSS is tedious and requires good visual testing).

Using "breakpointified" utilities can help slow this "class creep" in your projects.

Install

bower install bootstrap-breakpointify

Note: this library must be @imported after bootstrap, as it requires Bootstrap's responsive breakpoint mixins.

@import '../bower_components/bootstrap/scss/bootstrap';
@import '../bower_components/bootstrap-breakpointify/all';

Usage

Breakpoint suffixes are appended to the end of the normal classes. See the bootstrap docs for more information. All suffixes begin with either gt ("greater than") or lt ("less than").

"Greater-than" suffixes

"Greater-than" suffixes apply the class at the following Bootstrap breakpoints.

suffix | x-small | small | medium | large | x-large :-----: | :-----: | :---: | :----: | :---: | :-----: gt-xs | | ✓ | ✓ | ✓ | ✓ gt-sm | | | ✓ | ✓ | ✓ gt-md | | | | ✓ | ✓ gt-lg | | | | | ✓

"Less-than" suffixes

"Less-than" suffixes apply the class at the following Bootstrap breakpoints.

suffix | x-small | small | medium | large | x-large :-----: | :-----: | :---: | :----: | :---: | :-----: lt-sm | ✓ | | | | lt-md | ✓ | ✓ | | | lt-lg | ✓ | ✓ | ✓ | | lt-xl | ✓ | ✓ | ✓ | ✓ |

Available Prefixes

This library "breakpointifies" all of Bootstrap's utility clases.

Properties – First Character

  • m – margin
  • p - padding

Direction(s) – Second Character

  • t - top
  • r - right
  • b - bottom
  • l - left
  • x - x-axis (both left and right)
  • y - y-axis (both top and bottom)
  • a – all (all of the above: top, right, bottom, and left)

Size – Third Character

  • 0 – none
  • 1 – normal (the relevant Bootstrap $spacer value)
  • 2 – size 2 (the relevant Bootstrap "size 2" value – by default, $spacer * 1.5)
  • 3 – size 3 (the relevant Bootstrap "size 3" value – by default, $spacer * 3)

Examples

  • m-a-0-gt-lgmargin all size 0 greater than large – remove margin from all sides at breakpoints greater than Bootstrap's large (lg) breakpoint.
  • m-b-3-gt-mdmargin bottom size 3 greater than medium – apply "size 3" margin-bottom at breakpoints greater than Bootstrap's medium (md) breakpoint.
  • p-t-1-lt-mdpadding top size 1 less than medium – apply normal padding-top at breakpoints less than Bootstrap's medium (md) breakpoint.

What about unused CSS classes?

You could use UnCSS to programmatically remove unused CSS, but it's likely not worth the savings.

Browser rendering performance is not impacted by unused CSS classes, and this entire library adds the equivalent of a small icon to your page weight. Ensure your stylesheets are served with gzip compression for best optimization.