@csstools/utilities-for-private-properties
Utilities for private custom properties
Last updated 10 days ago by romainmenke .
MIT-0 · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @csstools/utilities-for-private-properties 
SYNC missed versions from official npm registry.

Utilities for Private Properties for PostCSS

npm version Build Status Discord

Transpile @private rules and private custom property references.

API

Read the API docs

Usage

Add Utilities for Private Properties to your project:

npm install @csstools/utilities-for-private-properties @csstools/css-parser-algorithms @csstools/css-tokenizer postcss --save-dev
import { createPrivatePropertyTranspiler } from '@csstools/utilities-for-private-properties';

const transpiler = createPrivatePropertyTranspiler({ namespace: 'p' });

const registrations = transpiler.transpile(root.nodes);
root.append(...registrations);

Nodes that are substituted into a style rule but are not its children, for example the contents of an @contents block, can be transpiled in the scope of that style rule:

transpiler.transpile(nodes, { scope: styleRule });

With preserve: true the @private rules are kept and references inside @apply and @contents blocks are left alone. Transpiled declarations are still hoisted, so the original notation keeps working where @private is supported.

@property rules are hoisted out of @layer, @media and @supports group rules, and the @layer, @media and @supports conditions are kept. @container, @scope and @starting-style do not constrain name-defining at-rules, so registrations inside them are hoisted without those conditions.

Current Tags

  • 1.0.1                                ...           latest (10 days ago)

3 Versions

  • 1.0.1                                ...           10 days ago
  • 1.0.0                                ...           10 days ago
  • 0.0.0-stage                                ...           10 days ago
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE