JSPM

postcss-short-spacing

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4497
  • Score
    100M100P100Q138568F
  • License CC0-1.0

Write shorthand margin and padding properties while omitting edges in CSS

Package Exports

  • postcss-short-spacing

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (postcss-short-spacing) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Shorthand Spacing Build Status

Shorthand Spacing is a PostCSS plugin that lets you write shorthand margin and padding properties while omitting edges in CSS.

/* before */

section {
    margin: 1em *;
}

/* after */

section {
    margin-top: 1em;
    margin-bottom: 1em;
}

Edges follow the 1-to-4 syntax and become top, right, bottom, and left properties. Asterisks indicate that the edge is skipped.

Usage

Follow these steps to use Shorthand Spacing.

Add Shorthand Spacing to your build tool:

npm install postcss-short-spacing --save-dev

Node

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

PostCSS

Add PostCSS to your build tool:

npm install postcss --save-dev

Load Shorthand Spacing as a PostCSS plugin:

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

Gulp

Add Gulp PostCSS to your build tool:

npm install gulp-postcss --save-dev

Enable Shorthand Spacing within your Gulpfile:

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

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

Grunt

Add Grunt PostCSS to your build tool:

npm install grunt-postcss --save-dev

Enable Shorthand Spacing within your Gruntfile:

grunt.loadNpmTasks('grunt-postcss');

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

Options

prefix

Type: String
Default: null

Specifies a prefix to be surrounded by dashes before the declarations (e.g. -x-margin or -x-padding).