postcss-prettify
Advanced tools
Comparing version
@@ -15,5 +15,11 @@ # Change Log | ||
Switch codebase to es6 with Babel transpilation. Optimize logic into one tree traversal. | ||
**ADD** | ||
- smart spacing and indentation around rules and declarations | ||
- only target top-level rules and comment for enforced empty linebreak | ||
## 0.2.0 — 3/11/16 | ||
Restructured logic for easy extending. | ||
Restructure logic for easy extending. | ||
@@ -25,3 +31,3 @@ **ADD** | ||
Switched from AVA to Mocha for tests because Travis-CI was throwing strange errors I don't feel like tracking down. | ||
Switch from AVA to Mocha for tests because Travis-CI was throwing strange errors I don't feel like tracking down. | ||
@@ -28,0 +34,0 @@ ## 0.1.0 — 3/10/16 |
{ | ||
"name": "postcss-prettify", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "prettify postcss output", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -1,3 +0,1 @@ | ||
# WARNING — recent breaking changes yet to be reflected in readme or changelog — will update ASAP | ||
# `postcss-prettify` [![version][1]][2] [![build][3]][4] [![coverage][5]][6] | ||
@@ -14,22 +12,20 @@ | ||
A [PostCSS](https://github.com/postcss/postcss) plugin to prettify output. Requires `node -v` >= `v4.0.0`. Should likely be included towards the end of a PostCSS plugin chain. | ||
A [PostCSS](https://github.com/postcss/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:** | ||
- newlines between rules | ||
**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** | ||
```css | ||
/* example input */ | ||
.foo, .bar { | ||
background: red; | ||
background: red; | ||
} | ||
@media only screen and (min-width: 600px) { | ||
.baz { | ||
background: blue; | ||
} | ||
} | ||
@media only screen and (min-width:600px){.baz{background:blue;}} | ||
``` | ||
**Example Output** | ||
```css | ||
/* example output */ | ||
.foo, | ||
@@ -49,3 +45,3 @@ .bar { | ||
From a terminal: | ||
**From a terminal** | ||
@@ -58,3 +54,4 @@ ```sh | ||
```javascript | ||
**As a PostCSS Plugin** | ||
```js | ||
postcss([ | ||
@@ -67,2 +64,16 @@ require('postcss-prettify') | ||
**Standalone** | ||
`postcss-prettify` also exposes a standalone [PostCSS processor instance](https://github.com/postcss/postcss/blob/master/docs/api.md#processorprocesscss-opts) as `prettify.process(css)`: | ||
```js | ||
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 | ||
@@ -69,0 +80,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
11017
6.73%85
14.86%0
-100%