JSPM

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

Use a place-* shorthand for align-* and justify-* in CSS

Package Exports

  • postcss-place

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-place) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

PostCSS Place Properties PostCSS Logo

NPM Version CSS Standard Status Build Status Windows Build Status Support Chat

PostCSS Place Properties lets you use place-* properties as shorthands for align-* and justify-*, following the CSS Box Alignment specification.

.example {
  place-self: center;
  place-content: space-between center;
}

/* becomes */

.example {
  align-self: center;
  justify-self: center;
  place-self: center;
  align-content: space-between;
  justify-content: center;
  place-content: space-between center;
}

Usage

Add PostCSS Place Properties to your build tool:

npm install postcss-place --save-dev

Node

Use PostCSS Place Properties to process your CSS:

import postcssPlace from 'postcss-place';

postcssPlace.process(YOUR_CSS, /* processOptions */, /* pluginOptions */);

PostCSS

Add PostCSS to your build tool:

npm install postcss --save-dev

Use PostCSS Place Properties as a plugin:

import postcss from 'gulp-postcss';
import postcssPlace from 'postcss-place';

postcss([
  postcssPlace(/* pluginOptions */)
]).process(YOUR_CSS);

Webpack

Add PostCSS Loader to your build tool:

npm install postcss-loader --save-dev

Use PostCSS Place Properties in your Webpack configuration:

import postcssPlace from 'postcss-place';

module.exports = {
  module: {
    rules: [
      {
        test: /\.css$/,
        use: [
          'style-loader',
          { loader: 'css-loader', options: { importLoaders: 1 } },
          { loader: 'postcss-loader', options: {
            ident: 'postcss',
            plugins: () => [
              postcssPlace(/* pluginOptions */)
            ]
          } }
        ]
      }
    ]
  }
}

Gulp

Add Gulp PostCSS to your build tool:

npm install gulp-postcss --save-dev

Use PostCSS Place Properties in your Gulpfile:

import postcss from 'gulp-postcss';
import postcssPlace from 'postcss-place';

gulp.task('css', () => gulp.src('./src/*.css').pipe(
  postcss([
    postcssPlace(/* pluginOptions */)
  ])
).pipe(
  gulp.dest('.')
));

Grunt

Add Grunt PostCSS to your build tool:

npm install grunt-postcss --save-dev

Use PostCSS Place Properties in your Gruntfile:

import postcssPlace from 'postcss-place';

grunt.loadNpmTasks('grunt-postcss');

grunt.initConfig({
  postcss: {
    options: {
      use: [
       postcssPlace(/* pluginOptions */)
      ]
    },
    dist: {
      src: '*.css'
    }
  }
});

Options

preserve

The preserve option determines whether the original place declaration is preserved. By default, it is preserved.

postcssPlace({ preserve: false })
.example {
  place-self: center;
  place-content: space-between center;
}

/* becomes */

.example {
  align-self: center;
  justify-self: center;
  align-content: space-between;
  justify-content: center;
}