postcss-custom-properties
Advanced tools
Comparing version
# Changes to PostCSS Custom Properties | ||
### 13.1.4 (February 21, 2023) | ||
- Fixed: exception on chained variable declarations. | ||
### 13.1.3 (February 8, 2023) | ||
@@ -4,0 +8,0 @@ |
import type { Node, Root } from 'postcss'; | ||
export declare function collectCascadeLayerOrder(root: Root): WeakMap<Node, number>; | ||
export declare function cascadeLayerNumberForNode(node: Node, layers: WeakMap<Node, number>): number; | ||
export declare function cascadeLayerNumberForNode(node: Node, layers: WeakMap<Node, number>): number | undefined; |
import type { Container, Declaration } from 'postcss'; | ||
declare function isBlockIgnored(container: Container): any; | ||
declare function isDeclarationIgnored(decl: Declaration): boolean; | ||
export { isBlockIgnored, isDeclarationIgnored, }; | ||
export declare function isBlockIgnored(container: Container | undefined): any; | ||
export declare function isDeclarationIgnored(decl: Declaration | undefined): boolean; |
import type { Rule } from 'postcss'; | ||
export declare function isProcessableRule(rule: Rule): boolean; | ||
export declare function isHtmlRule(rule: Rule): number; | ||
export declare function isRootRule(rule: Rule): number; | ||
export declare function isHtmlRule(rule: Rule): number | false; | ||
export declare function isRootRule(rule: Rule): number | false; |
@@ -1,2 +0,6 @@ | ||
declare const _default: (decl: any, customProperties: any, opts: any) => void; | ||
import valueParser from 'postcss-value-parser'; | ||
import type { Declaration } from 'postcss'; | ||
declare const _default: (decl: Declaration, customProperties: Map<string, valueParser.ParsedValue>, opts: { | ||
preserve?: boolean; | ||
}) => void; | ||
export default _default; |
@@ -1,1 +0,2 @@ | ||
export default function transformValueAST(root: any, customProperties: any): any; | ||
import valueParser from 'postcss-value-parser'; | ||
export default function transformValueAST(root: valueParser.ParsedValue, customProperties: Map<string, valueParser.ParsedValue>): string; |
{ | ||
"name": "postcss-custom-properties", | ||
"description": "Use Custom Properties Queries in CSS", | ||
"version": "13.1.3", | ||
"version": "13.1.4", | ||
"author": "Jonathan Neal <jonathantneal@hotmail.com>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -148,2 +148,29 @@ # PostCSS Custom Properties [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][PostCSS] | ||
## Modular CSS Processing | ||
If you're using Modular CSS such as, CSS Modules, `postcss-loader` or `vanilla-extract` to name a few, you'll probably | ||
notice that custom properties are not being resolved. This happens because each file is processed separately so | ||
unless you import the custom properties definitions in each file, they won't be resolved. | ||
To overcome this, we recommend using the [PostCSS Global Data](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-global-data#readme) | ||
plugin which allows you to pass a list of files that will be globally available. The plugin won't inject any extra code | ||
in the output but will provide the context needed to resolve custom properties. | ||
For it to run it needs to be placed before the [PostCSS Custom Properties] plugin. | ||
```js | ||
const postcss = require('postcss'); | ||
const postcssCustomProperties = require('postcss-custom-properties'); | ||
const postcssGlobalData = require('@csstools/postcss-global-data'); | ||
postcss([ | ||
postcssGlobalData({ | ||
files: [ | ||
'path/to/your/custom-selectors.css' | ||
] | ||
}), | ||
postcssCustomProperties(/* pluginOptions */) | ||
]).process(YOUR_CSS /*, processOptions */); | ||
``` | ||
[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test | ||
@@ -150,0 +177,0 @@ [css-url]: https://cssdb.org/#custom-properties |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
36924
5.96%87
8.75%183
17.31%