cssnano-utils
Utility methods and plugin for cssnano projects
Last updated 2 months ago by GitHub Actions .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install cssnano-utils 
SYNC missed versions from official npm registry.

cssnano-utils

Utility methods and plugins for cssnano projects.

API

PostCSS Utilities

Utility Description
rawCache PostCSS plugin that sets default formatting for generated AST nodes on result.root.rawCache.

CSS Tokenizer and Value Utilities

Utility Description
TokenType Re-exported TokenType enum from @csstools/css-tokenizer.
tokens Tokenize a CSS string into a CSSToken[] array with trailing EOF tokens stripped.
tokenStart Return the inclusive start character offset of a token (token[2]).
tokenEnd Return the exclusive end character offset of a token (token[3] + 1) for string slicing.
decoded Return the decoded string value of a token, falling back to its raw representation.
numeric Parse a single token into { number, unit }, or false if not a numeric token.
endsWithEscapingBackslash Whether a string ends in an odd run of backslashes, so the last one escapes whatever follows.
isHexDigitCode Whether a UTF-16 code unit is an ASCII hex digit (0-9, a-f, A-F).
mathFunctions Read-only Map from each CSS Values 4 math function name to its [min, max] inclusive argument count (max may be Infinity). Iterating yields [name, range] pairs; use .keys() for names.
balancedTokens Parse CSS into a BalancedTokens index of matching delimiters ((), [], {}), or undefined if unbalanced.
applyEdits Apply validated, non-overlapping string edits. Invalid bounds or overlaps fail closed by returning the complete original source.

BalancedTokens Methods

Instances returned by balancedTokens(source) provide:

  • endForOpening(index): Returns the closing token index for an opening delimiter token at index.
  • topLevelSegments(startIndex?, endIndex?, delimiter?): Splits a balanced token range by a top-level delimiter (defaults to comma).

Usage

import cssnanoUtils from 'cssnano-utils';

const { tokens, balancedTokens, applyEdits } = cssnanoUtils;

const structure = balancedTokens('cubic-bezier(0.1, 0.7, 1.0, 0.1)');
if (structure) {
  const segments = structure.topLevelSegments();
  // Process balanced segments
}

Contributors

See CONTRIBUTORS.md.

License

MIT

Current Tags

  • 9.0.0                                ...           latest (2 months ago)
  • 2.0.0-rc.2                                ...           next (6 years ago)
  • 4.0.0-nightly.2020.2.6                                ...           nightly (6 years ago)

53 Versions

  • 9.0.0                                ...           2 months ago
  • 8.2.1                                ...           2 months ago
  • 8.2.0                                ...           2 months ago
  • 8.1.0                                ...           2 months ago
  • 8.0.2                                ...           2 months ago
  • 8.0.1                                ...           2 months ago
  • 8.0.0                                ...           2 months ago
  • 7.0.3                                ...           2 months ago
  • 7.0.2                                ...           3 months ago
  • 7.0.1                                ...           3 months ago
  • 7.0.0                                ...           3 months ago
  • 6.0.4                                ...           3 months ago
  • 6.0.3                                ...           4 months ago
  • 6.0.2                                ...           4 months ago
  • 6.0.1                                ...           6 months ago
  • 6.0.0                                ...           7 months ago
  • 5.0.3                                ...           7 months ago
  • 5.0.2                                ...           7 months ago
  • 5.0.1                                ...           2 years ago
  • 5.0.0                                ...           3 years ago
  • 4.0.2                                ...           3 years ago
  • 4.0.1                                ...           3 years ago
  • 4.0.0                                ...           4 years ago
  • 3.1.0                                ...           5 years ago
  • 3.0.2                                ...           5 years ago
  • 3.0.1                                ...           5 years ago
  • 3.0.0                                ...           5 years ago
  • 2.0.1                                ...           6 years ago
  • 2.0.0                                ...           6 years ago
  • 2.0.0-rc.2                                ...           6 years ago
  • 2.0.0-rc.1                                ...           6 years ago
  • 2.0.0-rc.0                                ...           6 years ago
  • 2.0.0-alpha.0                                ...           6 years ago
  • 4.0.0-nightly.2020.2.6                                ...           6 years ago
  • 4.0.0-nightly.2020.1.11                                ...           6 years ago
  • 4.0.0-nightly.2020.1.9                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 4.0.0-nightly.2020.10.20                                ...           6 years ago
  • 4.0.0-nightly.2020.9.9                                ...           6 years ago
  • 4.0.0-nightly.2020.9.3                                ...           6 years ago
  • 4.0.0-nightly.2020.9.1                                ...           6 years ago
  • 4.0.0-nightly.2020.8.29                                ...           6 years ago
  • 4.0.0-nightly.2020.8.25                                ...           6 years ago
  • 4.0.0-nightly.2020.8.24                                ...           6 years ago
  • 4.0.0-nightly.2020.8.17                                ...           6 years ago
  • 4.0.0-nightly.2020.8.10                                ...           6 years ago
  • 4.0.0-nightly.2020.8.4                                ...           6 years ago
  • 4.0.0-nightly.2020.8.1                                ...           6 years ago
  • 4.0.0-nightly.2020.7.31                                ...           6 years ago
  • 4.0.0-nightly.2020.7.25                                ...           6 years ago
  • 4.0.0-nightly.2020.7.24                                ...           6 years ago
  • 5.0.0-nightly.0.7.7                                ...           6 years ago
  • 1.0.0                                ...           7 years ago

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