All Projects → ismamz → Postcss Utilities

ismamz / Postcss Utilities

Licence: mit
PostCSS plugin to add a collection of mixins, shortcuts, helpers and tools for your CSS

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Postcss Utilities

Postcss At Rules Variables
PostCss plugin to use CSS Custom Properties in at-rule @each, @for, @if, @else and more...
Stars: ✭ 52 (-82.25%)
Mutual labels:  postcss, postcss-plugins
Postcss Instagram
📷 PostCSS plugin for using Instagram filters in CSS
Stars: ✭ 111 (-62.12%)
Mutual labels:  postcss, postcss-plugins
Postcss Font Family System Ui
PostCSS plugin to transform W3C CSS font-family: system-ui to a practical font-family list
Stars: ✭ 91 (-68.94%)
Mutual labels:  postcss, postcss-plugins
Postcss Start To End
PostCSS plugin that lets you control your layout (LTR or RTL) through logical rather than physical rules
Stars: ✭ 18 (-93.86%)
Mutual labels:  postcss, postcss-plugins
postcss-if-media
A PostCSS plugin to inline or nest media queries within CSS rules & properties.
Stars: ✭ 35 (-88.05%)
Mutual labels:  postcss, postcss-plugins
Postcss Selector Not
PostCSS plugin to transform :not() W3C CSS level 4 pseudo class to more compatible CSS (multiple css3 :not() selectors)
Stars: ✭ 49 (-83.28%)
Mutual labels:  postcss, postcss-plugins
Postcss High Contrast
Create high contrast version of your project with ease.
Stars: ✭ 108 (-63.14%)
Mutual labels:  postcss, postcss-plugins
Stencil Postcss
Autoprefixer plugin for Stencil
Stars: ✭ 19 (-93.52%)
Mutual labels:  postcss, postcss-plugins
Stylefmt
stylefmt is a tool that automatically formats stylesheets.
Stars: ✭ 2,123 (+624.57%)
Mutual labels:  postcss, postcss-plugins
Rucksack
A little bag of CSS superpowers, built on PostCSS
Stars: ✭ 1,861 (+535.15%)
Mutual labels:  postcss, postcss-plugins
Postcss Cssnext
`postcss-cssnext` has been deprecated in favor of `postcss-preset-env`.
Stars: ✭ 5,388 (+1738.91%)
Mutual labels:  postcss, postcss-plugins
postcss-gtk
Processes GTK+ CSS into browser CSS
Stars: ✭ 23 (-92.15%)
Mutual labels:  postcss, postcss-plugins
Postcss Plugins
The "officially unofficial" consolidated list of PostCSS plugins in a ready-to-use package
Stars: ✭ 107 (-63.48%)
Mutual labels:  postcss, postcss-plugins
Postcss Aspect Ratio Mini
A PostCSS plugin to fix an element's dimensions to an aspect ratio
Stars: ✭ 123 (-58.02%)
Mutual labels:  postcss, postcss-plugins
laggard
Automatically generate CSS fallbacks for legacy browsers, built on PostCSS
Stars: ✭ 23 (-92.15%)
Mutual labels:  postcss, postcss-plugins
react-cli
基于 create-react-app 搭建的前端脚手架
Stars: ✭ 18 (-93.86%)
Mutual labels:  postcss, postcss-plugins
react-enterprise-starter-kit
Highly Scalable Awesome React Starter Kit for an enterprise application with a very easy maintainable codebase. 🔥
Stars: ✭ 55 (-81.23%)
Mutual labels:  postcss
Shopify Theme Lab
Shopify theme development environment using Liquid, Vue and Tailwind CSS 🧪
Stars: ✭ 250 (-14.68%)
Mutual labels:  postcss
storify
Instagram/Whatsapp stories clone built on Web Components and Web Animations API. 🔥
Stars: ✭ 64 (-78.16%)
Mutual labels:  postcss
floggy
Customizable logger for dart and flutter applications.
Stars: ✭ 61 (-79.18%)
Mutual labels:  mixins

PostCSS Utility Library Build Status

PostCSS Utility Library

postcss-utilities is a PostCSS plugin that includes the most commonly used mixins, shortcuts and helpers. It's as easy as specifying @util utility-name in your stylesheet, and postcss-utilities will handle the rest for you.

Check out the documentation to get started using postcss-utilities

Try it in the browser!

Motivation

PostCSS has a lot of plugins and some of them use non-standard CSS properties to work as mixins or helpers. This is not a best way for a PostCSS plugin, because developers will not understand what is the source of this property.

"This plugin saves us from many tiny plugins with unknown properties" @ai proposal postcss/issues/645

What is the difference between preprocessor’s mixins libraries?

There are lot of Sass Mixins Libraries (over 65!), but postcss-utilities makes the difference. All mixins and helpers are built with JavaScript and you can add to your workflow with ease, as simple as adding autoprefixer or many others useful PostCSS plugins.

You can forget about copy mixins from project to project and focus on write your project specific mixins and use this plugin for the most generic helpers.

  • You don’t need the extra files in your CSS codebase for mixins.
  • You don’t need mixins for vendor prefixing (use autoprefixer plugin)
  • You can use postcss-utilities with LESS, SASS, vanilla CSS or whatever you choice.

List of current utilities

IMPORTANT: The list of utilities is open for suggestions.

Examples

Input

.cfx {
    @util clearfix;
}

.rounded-top {
    @util border-top-radius(4px);
}

@util no-hover {
    .box {
        background-color: #666;
    }
}

Output

.cfx:after {
    content: '';
    display: block;
    clear: both;
}

.rounded-top {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.no-hover .box {
    background-color: #666;
}

Usage

Quick usage

Using PostCSS CLI you can do the following:

Install postcss-cli and the plugin on your project directory:

npm install postcss-cli postcss-utilities --save-dev

Add a postcss script to your package.json:

"scripts": {
    "postcss": "postcss input.css -u postcss-utilities -o output.css"
}

After this, you can run npm run postcss and transform your input.css into output.css.

Use with styled-jsx

styled-jsx allows you to use full, scoped and component-friendly CSS in your JSX (rendered on the server or the client) and you can add @util rules with postcss-utilities.

npm install --save styled-jsx styled-jsx-plugin-postcss postcss-utilities

Add postcss config in your package.json:

"postcss": {
    "plugins": {
        "postcss-utilities": {}
    }
}

Add styled-jsx/babel to plugins in your babel configuration:

{
  "plugins": [
    "styled-jsx/babel"
  ]
}

Then write @util rules in your code:

export default () => (
  <div>
    <p>only this paragraph will get the style :)</p>

    <style jsx>{`
      p {
        color: red;
        @util center;
      }
    `}</style>
  </div>
)

For tasks runners and others enviroments

postcss([ require('postcss-utilities')({ /* options*/ }) ])

See PostCSS docs for examples of your environment.

Options

noHoverSelector

Type: string
Default: .no-hover

To use with no-hover utility

noJsSelector

Type: string
Default: .no-js

To use with no-js utility

ie8

Type: boolean
Default: false

Set true to use clearfix method IE8 compatible

centerMethod

Type: string
Default: transform Values: ['transform'|'flexbox']

To use with center utility

textHideMethod

Type: string
Default: indent Values: ['indent'|'font']

To use with text-hide utility

Contributing

The list of utilities is open for suggestions.

Contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].