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 = opts.name instanceof RegExp
		? opts.name
	: 'name' in opts
		? new RegExp(`^${opts.name}$`, 'i')
	: 'extend';

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

postcss-nesting

Nest rules inside each other in CSS

MIT-0
Latest version published 16 days ago

Package Health Score

98 / 100
Full package analysis

Popular postcss-nesting functions