1.0.0 • Published 5 years ago

postcss-composes-enhanced v1.0.0

Weekly downloads
1
License
CC0-1.0
Repository
github
Last release
5 years ago

PostCSS Composes Enhanced

NPM Version Build Status Support Chat

PostCSS Composes Enhanced lets you enhance the composes behavior in CSS Modules.

.example {
  @composes no-margin from '@company/layout';
}

/* becomes */

.example {
  composes: no-margin from '../../node_modules/@company/layout/index.module.css';
}

Usage

Add PostCSS Composes Enhanced to your project:

npm install postcss-composes-enhanced --save-dev

Use PostCSS Composes Enhanced to process your CSS:

const composesEnhanced = require('postcss-composes-enhanced')

composesEnhanced.process(YOUR_CSS /*, processOptions, pluginOptions */)

Or use it as a PostCSS plugin:

const postcss = require('postcss')
const composesEnhanced = require('postcss-composes-enhanced')

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

PostCSS Composes Enhanced runs in all Node environments, with special instructions for:

NodePostCSS CLIWebpackCreate React AppGulpGrunt

Options

resolveImports

The resolveImports option determines whether imports within composes declarations should be resolved.

transformAtRules

The transformAtRules option determines whether @composes at-rules should be transformed into declarations.

Additional Options

Additional options will be passed through into css-import-resolve.