How to use postcss-nesting - 1 common examples

To help you get started, we’ve selected a few postcss-nesting examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github csstools / postcss-extend-rule / src / index.js View on Github external
import postcss from 'postcss';
import postcssNesting from 'postcss-nesting';

const nesting = postcssNesting();

// functional selector match
const functionalSelectorMatch = /(^|[^\w-])(%[_a-zA-Z]+[_a-zA-Z0-9-]*)([^\w-]|$)/i;

// plugin
export default postcss.plugin('postcss-extend-rule', rawopts => {
	// options ( onFunctionalSelector, onRecursiveExtend, onUnusedExtend)
	const opts = Object(rawopts);
	const extendMatch = instanceof RegExp
	: 'name' in opts
		? new RegExp(`^${}$`, 'i')
	: 'extend';

	return (root, result) => {
		const extendedAtRules = new WeakMap();


Nest rules inside each other in CSS

Latest version published 4 months ago

Package Health Score

98 / 100
Full package analysis

Popular postcss-nesting functions