Socket
Book a DemoInstallSign in
Socket

postcss-generate-preset

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-generate-preset

PostCSS plugin that allows quick generation of similar rules

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

postcss-generate-preset Build Status

PostCSS plugin that allows quick generation of rules. Useful for quickly creating repetitive utilities.

Installation

$ npm install postcss-generate-preset

Usage

input.css

@generate-preset .u-mp margin padding 0 10px;
@generate-preset .u-mt margin-top 10px 20px;

output.css

.u-mp0 {
  margin: 0;
  padding: 0;
}

.u-mp10 {
  margin: 10px;
  padding: 10px;
}

.u-mt10 {
  margin-top: 10px;
}

.u-mt20 {
  margin-top: 20px;
}
var presets = require('postcss-generate-preset');
postcss([ presets() ])

Options

useImportant (default: false)

When set to true all declarations will use !important. Often useful when utility classes need to override component styles

zeroValue (default): false)

The default is to add zero to a selector. In some cases it might be desirable to display it differently

presets({ zeroValue: 'Z' });
@generate-preset .u-m margin 0;

/* becomes */

.u-mZ {
  margin: 0;
}

See PostCSS docs for examples for your environment.

Keywords

postcss

FAQs

Package last updated on 01 Jan 2016

Did you know?

Socket

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.

Install

Related posts