Gathering detailed insights and metrics for @csstools/css-tokenizer
Gathering detailed insights and metrics for @csstools/css-tokenizer
Gathering detailed insights and metrics for @csstools/css-tokenizer
Gathering detailed insights and metrics for @csstools/css-tokenizer
npm install @csstools/css-tokenizer
Typescript
Module System
Min. Node Version
Node Version
NPM Version
CSS (43.3%)
JavaScript (30.21%)
TypeScript (22.88%)
HTML (3.03%)
Nunjucks (0.48%)
Shell (0.1%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT-0 License
984 Stars
4,381 Commits
77 Forks
9 Watchers
4 Branches
132 Contributors
Updated on Jul 13, 2025
Latest Version
3.0.4
Package Id
@csstools/css-tokenizer@3.0.4
Unpacked Size
71.27 kB
Size
14.79 kB
File Count
7
NPM Version
10.9.0
Node Version
22.12.0
Published on
May 27, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
No dependencies detected.
Implemented from : https://www.w3.org/TR/2021/CRD-css-syntax-3-20211224/
Add CSS Tokenizer to your project:
1npm install @csstools/css-tokenizer --save-dev
1import { tokenizer, TokenType } from '@csstools/css-tokenizer'; 2 3const myCSS = `@media only screen and (min-width: 768rem) { 4 .foo { 5 content: 'Some content!' !important; 6 } 7} 8`; 9 10const t = tokenizer({ 11 css: myCSS, 12}); 13 14while (true) { 15 const token = t.nextToken(); 16 if (token[0] === TokenType.EOF) { 17 break; 18 } 19 20 console.log(token); 21}
Or use the tokenize
helper function:
1import { tokenize } from '@csstools/css-tokenizer'; 2 3const myCSS = `@media only screen and (min-width: 768rem) { 4 .foo { 5 content: 'Some content!' !important; 6 } 7} 8`; 9 10const tokens = tokenize({ 11 css: myCSS, 12}); 13 14console.log(tokens);
1{ 2 onParseError?: (error: ParseError) => void 3}
onParseError
The tokenizer is forgiving and won't stop when a parse error is encountered.
To receive parsing error information you can set a callback.
1import { tokenizer, TokenType } from '@csstools/css-tokenizer'; 2 3const t = tokenizer({ 4 css: '\\', 5}, { onParseError: (err) => console.warn(err) }); 6 7while (true) { 8 const token = t.nextToken(); 9 if (token[0] === TokenType.EOF) { 10 break; 11 } 12}
Parser errors will try to inform you where in the tokenizer logic the error happened. This tells you what kind of error occurred.
Things this package aims to be:
What it is not:
No vulnerabilities found.
Reason
30 commit(s) and 7 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
1 existing vulnerabilities detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 1/24 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More