From b1e2c8fd5cb5dfa46bc440a12eafaf56cd844b1c Mon Sep 17 00:00:00 2001 From: Philipp Tanlak Date: Mon, 24 Nov 2025 20:54:57 +0100 Subject: Docs --- node_modules/@tailwindcss/nesting/index.js | 46 ++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 node_modules/@tailwindcss/nesting/index.js (limited to 'node_modules/@tailwindcss/nesting/index.js') diff --git a/node_modules/@tailwindcss/nesting/index.js b/node_modules/@tailwindcss/nesting/index.js new file mode 100644 index 0000000..8ff7f63 --- /dev/null +++ b/node_modules/@tailwindcss/nesting/index.js @@ -0,0 +1,46 @@ +let postcss = require('postcss') +let postcssNested = require('postcss-nested') + +module.exports = (opts = postcssNested) => { + return { + postcssPlugin: '@tailwindcss/nesting', + Once(root, { result }) { + root.walkAtRules('screen', (rule) => { + rule.name = 'media' + rule.params = `screen(${rule.params})` + }) + + root.walkAtRules('apply', (rule) => { + rule.before(postcss.decl({ prop: '__apply', value: rule.params })) + rule.remove() + }) + + let plugin = (() => { + if (typeof opts === 'function') { + return opts + } + + if (typeof opts === 'string') { + return require(opts) + } + + if (Object.keys(opts).length <= 0) { + return postcssNested + } + + throw new Error('@tailwindcss/nesting should be loaded with a nesting plugin.') + })() + + postcss([plugin]).process(root, result.opts).sync() + + root.walkDecls('__apply', (decl) => { + decl.before(postcss.atRule({ name: 'apply', params: decl.value })) + decl.remove() + }) + + return root + }, + } +} + +module.exports.postcss = true -- cgit v1.2.3