Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
This project is intended to be a reference implementation to the latest Editor's Draft of the CSS Syntax Level 3 specification. As this edition of the specification evolves, so will the implementation.
The code attempts to follow the specification verbatim, with the least amount of code additions possible.
npm i cssprima
> cssprima.tokenize('#headlines:nth-child(2n)');
[ { type: 'Hash',
typeFlag: 'id',
value: 'headlines' },
{ type: 'Colon', value: ':' },
{ type: 'Function', value: 'nth-child' },
{ type: 'Dimension',
repr: '2',
value: 2,
typeFlag: 'integer',
unit: 'n' },
{ type: 'RightParen', value: ')' } ]
> var rule = '.clearfix { clear: both; }';
undefined
> cssprima.parseRule(rule);
{ type: 'QualifiedRule',
prelude:
[ { type: 'Delim', value: '.' },
{ type: 'Identifier', value: 'clearfix' },
{ type: 'Whitespace', value: ' ' } ],
value: null,
block:
{ type: 'SimpleBlock',
associatedToken: { type: 'LeftBrace' },
value:
[ { type: 'Whitespace', value: ' ' },
{ type: 'Identifier', value: 'clear' },
{ type: 'Colon', value: ':' },
{ type: 'Whitespace', value: ' ' },
{ type: 'Identifier', value: 'both' },
{ type: 'Semicolon', value: ';' },
{ type: 'Whitespace', value: ' ' } ] } }
> cssprima.Types
{ IDENT: 'Identifier',
FUNCTION: 'Function',
AT_KEYWORD: 'AtKeyword',
HASH: 'Hash',
STRING: 'String',
BAD_STRING: 'BadString',
URL: 'URL',
BAD_URL: 'BadURL',
DELIM: 'Delim',
NUMBER: 'Number',
PERCENTAGE: 'Percentage',
DIMENSION: 'Dimension',
UNICODE_RANGE: 'UnicodeRange',
INCLUDE_MATCH: 'IncludeMatch',
... }
This project passes css-parsing-tests, written by the specification's co-author Simon Sapin.
$ npm test
> cssprima@0.1.0 test c:\Users\ezequiel\Desktop\cssprima
> tap test/tap/*.js
ok test/tap/parsing.js .............................. 136/136
total ............................................... 136/136
ok
FAQs
The most standards compliant CSS parser.
The npm package cssprima receives a total of 2 weekly downloads. As such, cssprima popularity was classified as not popular.
We found that cssprima demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.