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-shortify

v2.0.1

Published

simplify and shorify the long unclear bootstrap classes that relate to columns, offsets, pulls and pushes.

Downloads

8

Readme

##Bootstrap Shortify

Installation

First, install it from npm:

npm install bootstrap-shortify

Then, require it as a CommonJs module or import it in ES6 - I recommend some short names for the functions, to keep the code as clear as possible:

const _c = require('bootstrap-shortify').bColumn();
const _o = require('bootstrap-shortify').bOffset();
const _ps = require('bootstrap-shortify').bPush();
const _pl = require('bootstrap-shortify').bPull();

###Basic usage

Bootstrap shortify is designed to help you use bootstrap classes related to different media queries in a more succinct manner. Futhermore, it makes dynamic chages to the classes very easy. It is particurally useful when you use it with React.js components or while rendering html markup on the server side.

Imagine writing:

col-xs-12 col-sm-12 col-md-6 col-lg-6

A bit long and confusing, isn't it?

How about:

_c(12,12,6,6)

The function _c takes four number or string arguments _c(xs, sm, md, lg) and returnes related bootstrap classes.

You can also use one argument that is an array:

var arr = [12,12,6,6]
console.log( _c(arr) );

Or an object:

var obj = {xs:12, sm:12, md: 6, lg: 6}

console.log( _c(obj) );

You can mix string and number arguments:

console.log( _c([12,"12",6,"6"]) );

###Default values

You can add default values while requireing the module like so:

_c = require(bootstrap-shortify).bColumn(12,12,6,6);

Now, if you use _c() with no arguments, by default, it will return col-xs-12 col-sm-12 col-md-6 col-lg-6

If you don't specify the default values bootstrap-shortify will assume that they are all 12 for columns, and all 0 for push, pull and offset.

###Omitting Classes

To omit a class for one of the viewports simply put 0 as its value, like so:

_c(12,0,0,6);

It wil produce:

col-xs-12 col-lg-6