New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

postcss-prettify

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-prettify

prettify postcss output

0.3.4
latest
Source
npm
Version published
Weekly downloads
1K
-28.07%
Maintainers
1
Weekly downloads
 
Created
Source

postcss-prettify version build coverage

About | Installation | Usage | License

About

A PostCSS plugin to prettify output. Requires at least Node.js v0.12. Should likely be included towards the end of a PostCSS plugin chain, if that's your jam.

Features

  • line breaks between top-level rules and comments
  • smart spacing around rules and declarations
  • indenting with 2 spaces
  • one selector per line

Example Input

.foo, .bar {
    background: red;
}
@media only screen and (min-width:600px){.baz{background:blue;}}

Example Output

.foo,
.bar {
  background: red;
}

@media only screen and (min-width: 600px) {
  .baz {
    background: blue;
  }
}

Installation

From a terminal

npm install --save-dev postcss-prettify

Usage

As a PostCSS Plugin

postcss([
  require('postcss-prettify')
])

Check the PostCSS docs for your chosen implementation.

Standalone

postcss-prettify also exposes a standalone PostCSS processor instance as prettify.process(css):

var fs = require('mz/fs')
var prettify = require('postcss-prettify')

fs.readFile('src/style.css', 'utf8')
  .then(data => prettify.process(data))
  .then(res => fs.writeFile('dist/style.css', res.css))
  .catch(err => console.err(err.stack))

License

MIT

Keywords

postcss-plugin

FAQs

Package last updated on 17 Mar 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