
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
spacing-classes
Advanced tools
#spacing-classes
Stylus mixin, inspired by Bootstrap, to add margin and padding css helper classes.
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;
}
// ...
}
$ npm install spacing-classes
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
}));
To print the classes in a css file:
@import 'spacing-classes'
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);
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
}
FAQs
Bootstrap inspired margin and padding classes
We found that spacing-classes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.