Giter Club home page Giter Club logo

postcss-short-text's Introduction

Short Text PostCSS Logo

NPM Version Build Status Licensing Gitter Chat

Short Text is a PostCSS plugin that lets you use a shorthand text property in CSS.

/* before */

section {
    text: bold center uppercase dimgrey 1.25em 1.5 .05em;
}

article {
    text: 1.25em * .05em;
}

/* after */

section {
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    color: dimgrey;
    font-size: 1.25em;
    line-height: 1.5;
    letter-spacing: .05em;
}

article {
    font-size: 1.25em;
    letter-spacing: .05em;
}

Properties are matched into groups that may be written in any order. Once a property is matched to a group, other properties from that group must then be written before properties of another group. Asterisks indicate that an individual property in a group should be skipped. The groups include:

  • color
  • font-style, font-variant, font-weight, font-stretch
  • text-decoration, text-align, text-rendering, text-transform
  • white-space
  • font-size, line-height, letter-spacing, word-spacing

Usage

Follow these steps to use Short Text.

Add Short Text to your build tool:

npm install postcss-short-text --save-dev

Node

require('postcss-short-text')({ /* options */ }).process(YOUR_CSS);

PostCSS

Add PostCSS to your build tool:

npm install postcss --save-dev

Load Short Text as a PostCSS plugin:

postcss([
    require('postcss-short-text')({ /* options */ })
]);

Gulp

Add Gulp PostCSS to your build tool:

npm install gulp-postcss --save-dev

Enable Short Text within your Gulpfile:

var postcss = require('gulp-postcss');

gulp.task('css', function () {
    return gulp.src('./css/src/*.css').pipe(
        postcss([
            require('postcss-short-text')({ /* options */ })
        ])
    ).pipe(
        gulp.dest('./css')
    );
});

Grunt

Add Grunt PostCSS to your build tool:

npm install grunt-postcss --save-dev

Enable Short Text within your Gruntfile:

grunt.loadNpmTasks('grunt-postcss');

grunt.initConfig({
    postcss: {
        options: {
            processors: [
                require('postcss-short-text')({ /* options */ })
            ]
        },
        dist: {
            src: 'css/*.css'
        }
    }
});

Options

prefix

Type: String
Default: null

Specifies a prefix to be surrounded by dashes before the declaration (e.g. -x-text).

postcss-short-text's People

Contributors

jonathantneal avatar armano2 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.