Skip to main content

@stylexjs/postcss-plugin

Configuration options

babelConfig

babelConfig: object; // Default: {}

Options for Babel configuration. By default, the plugin reads the babel.config.js in your project. For custom configurations, set babelrc: false and specify desired options. Refer to Babel Config Options for available options.


cwd

cwd: string; // Default: process.cwd()

Working directory for the plugin; defaults to process.cwd().


exclude

exclude: string[] // Default: []

Array of paths or glob patterns to exclude from compilation. Paths in exclude take precedence over include.


include

include: string[] // Required

Array of paths or glob patterns to compile.


useCSSLayers

useCSSLayers: 'none' | 'native' | 'polyfill'; // Default: 'none'

The useCSSLayers option controls how StyleX handles CSS specificity and layer management. It supports three strategies:

  • 'none' (default): Uses :not(#\#) to handle CSS specificity without layers
  • 'native': Uses native CSS @layer for handling CSS specificity
  • 'polyfill': Uses @csstools/postcss-cascade-layers to polyfill CSS layers for browsers that don't support them