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

spacing-classes

v0.3.1

Published

Bootstrap inspired margin and padding classes

Downloads

7

Readme

#spacing-classes

Stylus mixin, inspired by Bootstrap, to add margin and padding css helper classes.

What's it do?

Makes adding padding and margins a class based thing in cases where a custom class is overkill.

Basically: It supplies a bunch of helper classes

see the default output

@media (min-width: 992px) {
 .pad-md-top-3 {
   padding-top: 3px;
 }
 
 .pad-md-left-3 {
   padding-left: 3px;
 }
 
 // ...

}

Installation

$ npm install spacing-classes

Javascript API

spacing classes relies on stylus to work, though included are CSS files that you can pull directly.

var connect = require('connect')
  , stylus = require('stylus')
  , spacingClasses = require('spacing-classes');

// In this case we supply our own sizes.  calling .compile() is optional
spacingClasses.compile({sizes: [1, 3, 5, 7]});

var server = connect();

function compile(str, path) {
  return stylus(str)
	.set('filename', path)
	.set('compress', true)
	.use(spacingClasses());
}

server.use(stylus.middleware({
	src: __dirname
  , compile: compile
}));

Stylus API

To print the classes in a css file:

@import 'spacing-classes'

Customizing

These are the default settings.

Pass one or more of these attributes to spacingClasses.compile().

The following would be identical to not compiling at all ( as they are the defaults ), or compiling with no options.

var settings    = {
  important: false,
  directions: [ 'top', 'left', 'right', 'bottom', '' ],
  sizes:      [ 3, 7, 15, 22, 30 ],
  screens: {
    xs: null,
    sm: 768,
    md: 992,
    lg: 1200,
  },
  types: [
    {key: 'pad', cssType: 'padding'}, // important: true can be added
    {key: 'marg', cssType: 'margin'}, // type.important overrides the settings.important
    {key: 'marg', cssType: 'margin', inverse: true},
  ],
};

spacingClasses = require('spacing-classes')
spacingClasses.compile(settings);

inverse: true (optional)

Note the inverse: true on the 3rd type.

add -inv to the end of a margin class to get negative amounts

marg-xs-top-3-inv {
  margin-top: -3px
}