Gathering detailed insights and metrics for @netlify/classnames-template-literals
Gathering detailed insights and metrics for @netlify/classnames-template-literals
Gathering detailed insights and metrics for @netlify/classnames-template-literals
Gathering detailed insights and metrics for @netlify/classnames-template-literals
Small utility to format long classnames with template literals
npm install @netlify/classnames-template-literals
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
75 Stars
11 Commits
3 Forks
4 Watchers
3 Branches
7 Contributors
Updated on Dec 14, 2024
Latest Version
1.0.3
Package Id
@netlify/classnames-template-literals@1.0.3
Unpacked Size
4.83 kB
Size
2.18 kB
File Count
7
NPM Version
6.13.4
Node Version
12.14.1
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
4
Utility originally created to deal with long Tailwind classnames.
To make our code more readable, we extract our Tailwind classes into variables, for example:
1const twClasses = ` 2 tw-sr-only 3 focus:tw-not-sr-only 4 tw-bg-teal-darker 5 tw-text-white 6 tw-block 7 tw-text-sm 8 tw-l-0 9`;
The issue with writing classes this way is that they are rendered as-is in the DOM.
Example:
1<p 2 class=" 3 tw-sr-only 4 focus:tw-not-sr-only 5 tw-bg-teal-darker 6 tw-text-white 7 tw-block 8 tw-text-sm 9 tw-l-0" 10> 11 Hello world 12</p>
Using the ctl
util formats classnames so they are rendered in a more standard way in the DOM.
Example:
1<p class="tw-sr-only focus:tw-not-sr-only tw-bg-teal-darker tw-text-white tw-block tw-text-sm tw-l-0"> 2 Hello world 3</p>
1npm install @netlify/classnames-template-literals
Wrap your classnames inside ctl
.
1import ctl from "@netlify/classnames-template-literals"; 2 3const buttonClasses = ctl(` 4 bg-black 5 text-white 6 p-1 7 rounded-sm 8`);
You can also use conditional classes:
1import ctl from "@netlify/classnames-template-literals"; 2 3const buttonClasses = ctl(` 4 bg-black 5 text-white 6 p-1 7 rounded-sm 8 ${someState && "bg-pink"} 9`);
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 2/8 approved changesets -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
25 existing vulnerabilities detected
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