
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
postcss-scrib
Advanced tools
PostCSS plugin to let you write shortcuts for your favourite properties and their favourite values.
PostCSS plugin to let you write shortcuts for your favourite properties and their favourite values.
# my-scrib-shortcuts.txt
b border # Define a property shortcut.
bt border-top
bb border-bottom
d display
b block # Define a value shortcut by indenting under a property.
ib inline-block
tr table-row
c color
bgc background-color
tr transparent # Value shortcuts work for a group of multiple properties too (seperate groups with double-newlines).
*
au auto # If necessary, Use * for generic value shortcuts (i.e. not tied to any property).
/* Input.css */
tr.fancy-class {
b: solid 1px black;
d: b;
c: white;
bgc: tr;
overflow: au;
}
/* output.css */
tr.fancy-class { /* <-- 'tr' only affects properties, so the selector remains safe */
border: solid 1px black;
display: block;
color: white;
background-color: transparent;
overflow: auto;
}
Similar Libraries (may fit your use case better):
@alias rule// Pass a list of shortcuts (formatted like the example on top of this readme) as a string to postcss-scrib
var shortcuts = 'b border\nd display\n b block';
postcss([require('postcss-scrib')(shortcuts)]);
// OR
// Pass in an options object with with 1 of the following keys: 1) shortcuts, 2) file, or 3) tree.
var options = {
shortcuts: 'b border\nd display\n b block', // List of shortcut definitions
// OR
file: './my-shortcut-file.txt', // Path to a file that contains shortcut definitions (passed directly to fs.readFile).
// OR
tree: {b: 'border', d: 'display', b: 'block'} // Alternative intermediate JS representation.
};
postcss([require('postcss-scrib')(options)]);
See PostCSS docs for examples for your environment.
Using the tree option, you have the choice of writing your shortcuts directly in JS, instead of in this plugin's custom format. It is slightly more verbose, but may come in useful in cases where you wish to generate shortcuts programmatically, or modify shortcuts at a later time. Converting the example at the top of this readme into a tree gives us:
{ b: 'border',
bt: 'border-top',
bb: 'border-bottom',
d:
{ _becomes: 'display',
_shortcuts: { b: 'block', ib: 'inline-block', tr: 'table-row' } },
c: { _becomes: 'color', _shortcuts: { tr: 'transparent' } },
bgc:
{ _becomes: 'background-color',
_shortcuts: { tr: 'transparent' } }, // same _shortcuts object reference as c.
'*': { _becomes: undefined, _shortcuts: { au: 'auto' } } }
parseShortcutText is available as a method on the module if you wish to generate such a tree:
var scrib = require('postcss-scrib');
scrib.parseShortcutText('b border\nd display\n b block');
// >> {b: 'border', d: 'display', b: 'block'}
As a reference, here's the shortcuts that I use. I'd suggest to keep the shortcuts tight, and define them only for the props/values you really need (as opposed to going overboard and short-cutting the entire language, then forgetting them all tomorrow morning).
# sneakertack's shortcuts
d display
b block
i inline
ib inline-block
n none
t table
tr table-row
tc table-cell
pos position
rel relative
abs absolute
m margin
mt margin-top
mb margin-bottom
ml margin-left
mr margin-right
b border
bt border-top
bb border-bottom
bl border-left
br border-right
p padding
pt padding-top
pb padding-bottom
pl padding-left
pr padding-right
f font
ff font-family
fs font-size
c color
bg background
bgc background-color
ts text-shadow
bs box-shadow
f float
l left
r right
FAQs
PostCSS plugin to let you write shortcuts for your favourite properties and their favourite values.
We found that postcss-scrib 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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.