diff options
| author | Philipp Tanlak <philipp.tanlak@gmail.com> | 2025-11-24 20:54:57 +0100 |
|---|---|---|
| committer | Philipp Tanlak <philipp.tanlak@gmail.com> | 2025-11-24 20:57:48 +0100 |
| commit | b1e2c8fd5cb5dfa46bc440a12eafaf56cd844b1c (patch) | |
| tree | 49d360fd6cbc6a2754efe93524ac47ff0fbe0f7d /node_modules/autoprefixer/lib/at-rule.js | |
Docs
Diffstat (limited to 'node_modules/autoprefixer/lib/at-rule.js')
| -rw-r--r-- | node_modules/autoprefixer/lib/at-rule.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/node_modules/autoprefixer/lib/at-rule.js b/node_modules/autoprefixer/lib/at-rule.js new file mode 100644 index 0000000..d36a279 --- /dev/null +++ b/node_modules/autoprefixer/lib/at-rule.js @@ -0,0 +1,35 @@ +let Prefixer = require('./prefixer') + +class AtRule extends Prefixer { + /** + * Clone and add prefixes for at-rule + */ + add(rule, prefix) { + let prefixed = prefix + rule.name + + let already = rule.parent.some( + i => i.name === prefixed && i.params === rule.params + ) + if (already) { + return undefined + } + + let cloned = this.clone(rule, { name: prefixed }) + return rule.parent.insertBefore(rule, cloned) + } + + /** + * Clone node with prefixes + */ + process(node) { + let parent = this.parentPrefix(node) + + for (let prefix of this.prefixes) { + if (!parent || parent === prefix) { + this.add(node, prefix) + } + } + } +} + +module.exports = AtRule |