Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-extend

Package Overview
Dependencies
Maintainers
2
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-extend - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

index.js

@@ -226,3 +226,3 @@ 'use strict';

var newNode = postcss.rule();
newNode.semicolon = atRule.semicolon;
newNode.raws.semicolon = atRule.raws.semicolon;
safeCopyDeclarations(backFirstTargetNode, newNode);

@@ -229,0 +229,0 @@ newNode.selector = formSubSelector(atRule.parent.selectors, extTgtSub).join(', ');

@@ -8,3 +8,3 @@ {

"license": "MIT",
"version": "1.0.4",
"version": "1.0.5",
"description": "As close to cssnext @extend as possible for PostCSS",

@@ -11,0 +11,0 @@ "homepage": "https://github.com/travco/postcss-extend",

@@ -75,3 +75,3 @@ # postcss-extend [![Build Status](https://travis-ci.org/travco/postcss-extend.svg?branch=master)](https://travis-ci.org/travco/postcss-extend)

With `@define-placeholder`, you associate a rule set with a placeholder selector, which you will later extend with concrete selectors. It (and its other aliases) can only be extended if it's already been declared in the document, and *cannot be extended-out-of*.
With `@define-placeholder`, you associate a rule set with a placeholder selector, which you will later extend with concrete selectors. It (and its other aliases) can only be extended if it's already been declared in the document, is at the root-level (not inside anything) and *cannot be extended-out-of*.

@@ -94,4 +94,18 @@ You can also use its aliases: `@define-extend` or `@extend-define`.

The "%" placeholder acts in exactly the same way as `@define-placeholder` and its aliases, with three exceptions. One, that it doesn't need to be declared before it is extended. Two, you can extend out of it (thus extending anything that extends the placeholder, or nothing if the placeholder isn't referenced). Three, it needs to be specifically targeted in the extend, for example: `@extend %simple-list`.
The "%" placeholder acts similarly to `@define-placeholder` and its aliases, with four exceptions. One, that it doesn't need to be declared before it is extended. Two, you can extend out of it (thus extending anything that extends the placeholder, or nothing if the placeholder isn't referenced). Three, it needs to be specifically targeted in the extend, for example: `@extend %simple-list`. Four, it doesn't need to be at the root in order to work - and can be inside of something else (e.g. an `@media`):
```css
%container {
padding-left: 15px;
}
@media (--md-viewport) {
%container {
padding-left: 2em;
}
}
.extendingClass {
@extend %container;
}
```
(`@define-placeholder`'s limitations are an originally unintended feature, kept for its possible usefulness as a stricter, more controlled method of extending).

@@ -367,3 +381,3 @@

- **Order of Processing/Specificity** In normal cases, the document is processed top-to-bottom; however, as a feature-fallout of the implementation, it is capable of extending in an anti-pattern (extending things yet to be declared). If what you're writing is an anti-pattern, it will throw a warning.
- **Specificity Inheritance** [Unlike examlple 5 in the spec](http://tabatkins.github.io/specs/css-extend-rule/#issue-bd856557), `@extend` in this plugin *will not* maintain the specificity of the rules extended to. Avoiding anti-patterns in your CSS will allow you to avoid this becoming an issue (pending browser implemenation). Does not log a warning.
- **Specificity Inheritance** [Unlike example 5 in the spec](http://tabatkins.github.io/specs/css-extend-rule/#issue-bd856557), `@extend` in this plugin *will not* maintain the specificity of the rules extended to. Avoiding anti-patterns in your CSS will allow you to avoid this becoming an issue (pending browser implemenation). Does not log a warning.
- **Media-cross-media Inheritance** Attempting to extend a rule inside a media block from within another media block [is directly disallowed in the code](https://github.com/travco/postcss-extend#extending-something-in-an-media-while-inside-an-media) and will throw a warning.

@@ -370,0 +384,0 @@ - **Silent placeholders** Includes both the stricter `@define-placeholder` and its aliases for compatibility with [simple-extend](https://github.com/davidtheclark/postcss-simple-extend), and the `%` placeholder [from the spec](https://tabatkins.github.io/specs/css-extend-rule/#placeholder). As this isn't the native parser, the placeholder will be wiped from the CSS if it goes unused (as well as throw a warning).

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc