Skip to content

Latest commit

 

History

History
172 lines (129 loc) · 3.62 KB

INSTALL.md

File metadata and controls

172 lines (129 loc) · 3.62 KB

Installing PostCSS

PostCSS Logical Properties and Values runs in all Node environments, with special instructions for:

Node PostCSS CLI Webpack Create React App Gulp Grunt

Node

Add PostCSS Logical Properties and Values to your project:

npm install postcss-logical --save-dev

Use PostCSS Logical Properties and Values to process your CSS:

const postcssLogical = require('postcss-logical');

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

Or use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssLogical = require('postcss-logical');

postcss([
  postcssLogical(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);

PostCSS CLI

Add PostCSS CLI to your project:

npm install postcss-cli --save-dev

Use PostCSS Logical Properties and Values in your postcss.config.js configuration file:

const postcssLogical = require('postcss-logical');

module.exports = {
  plugins: [
    postcssLogical(/* pluginOptions */)
  ]
}

Webpack

Add PostCSS Loader to your project:

npm install postcss-loader --save-dev

Use PostCSS Logical Properties and Values in your Webpack configuration:

const postcssLogical = require('postcss-logical');

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

Create React App

Add React App Rewired and React App Rewire PostCSS to your project:

npm install react-app-rewired react-app-rewire-postcss --save-dev

Use React App Rewire PostCSS and PostCSS Logical Properties and Values in your config-overrides.js file:

const reactAppRewirePostcss = require('react-app-rewire-postcss');
const postcssLogical = require('postcss-logical');

module.exports = config => reactAppRewirePostcss(config, {
  plugins: () => [
    postcssLogical(/* pluginOptions */)
  ]
});

Gulp

Add Gulp PostCSS to your project:

npm install gulp-postcss --save-dev

Use PostCSS Logical Properties and Values in your Gulpfile:

const postcss = require('gulp-postcss');
const postcssLogical = require('postcss-logical');

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

Grunt

Add Grunt PostCSS to your project:

npm install grunt-postcss --save-dev

Use PostCSS Logical Properties and Values in your Gruntfile:

const postcssLogical = require('postcss-logical');

grunt.loadNpmTasks('grunt-postcss');

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