GitXplorerGitXplorer
s

postcss-responsive-hints

public
7 stars
1 forks
18 issues

Commits

List of commits on branch master.
Unverified
fbcca4fa0812dc6dc233845ec2230a2abe540acd

feat: release v1.0.0

ssmashercosmo committed 5 years ago
Unverified
f6a45d7e0aac8bcb5a97256fa0988351c19191f6

Docs: add 'options' section

ssmashercosmo committed 7 years ago
Unverified
ab64a6811fd932f53fe7106a67f1c31a75dd8282

Fix: incorrect check for responsiveValues length

ssmashercosmo committed 7 years ago
Unverified
df79c83d2d1baff3b1a3039557cd0f0df701b8a7

Changelog: 🚀

ssmashercosmo committed 7 years ago
Unverified
76c2dd7b02d893e934709ce66c1ee163b561069a

Chore: add node 8 to travis

ssmashercosmo committed 7 years ago
Unverified
c30aee7be2dbabc109f5226bfe122179cbbd0131

Chore: use latest npm in travis

ssmashercosmo committed 7 years ago

README

The README file for this repository.

postcss-responsive-hints

PostCSS plugin that makes it easier to write responsive styles. Heavily inspired by styled-system.

Installation

$ npm install postcss-responsive-hints

Usage

const postcss = require("postcss")

const output = postcss()
  .use(require('postcss-responsive-hints')({/* options */}))
  .process(require("fs").readFileSync("input.css", "utf8"))
  .css

Having the following styles in input.css:

.test {
    padding: 10px | 20px | x | 30px;
}

you will get:

.test {
    padding: 10px;
}

@media (min-width: 480px) {
    .test {
        padding: 20px;
    }
}

/* 768px media query will be skipped */

@media (min-width: 1024px) {
    .test {
        padding: 30px;
    }
}

Options

breakpoints: Array<string>

default: ['480px', '768px', '1024px', '1200px']

Provide a custom set of breakpoints

comments: boolean

default: false

Allows to avoid non-standard syntax by wrapping responsive hints in css comments

Example:

.test {
    padding: 10px /* | 20px | x | 30px | */;
}

TODO

  • Write better docs
  • Write tests
  • Make semantic-release work