Gathering detailed insights and metrics for svelte-preprocess-css-hash
Gathering detailed insights and metrics for svelte-preprocess-css-hash
npm install svelte-preprocess-css-hash
Typescript
Module System
Node Version
NPM Version
65.9
Supply Chain
89.5
Quality
76.7
Maintenance
100
Vulnerability
100
License
TypeScript (95.95%)
JavaScript (4.05%)
Total Downloads
2,714
Last Day
8
Last Week
16
Last Month
72
Last Year
532
9 Stars
23 Commits
1 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
0.2.0
Package Id
svelte-preprocess-css-hash@0.2.0
Unpacked Size
4.58 kB
Size
2.18 kB
File Count
5
NPM Version
10.2.4
Node Version
21.5.0
Publised On
21 Nov 2024
Cumulative downloads
Total Downloads
Last day
166.7%
8
Compared to previous day
Last week
33.3%
16
Compared to previous week
Last month
166.7%
72
Compared to previous month
Last year
-36.7%
532
Compared to previous year
4
Passing hashed css class name to child component. It is used to avoid class name conflicts.
input:
1<style> 2 :global(.-child-cls) { 3 color: red; 4 } 5 6 :global(.-child-cls:hover .-nested-cls) { 7 color: green; 8 } 9 10 :global(html.night .-child-cls .-nested-cls) { 11 color: blue; 12 } 13</style> 14 15<ChildComponent class="-child-cls" />
output:
1<style> 2 :global(.-child-cls-pXX_fA) { 3 color: red; 4 } 5 6 /* only the first class name that is prefixed with '-' will be hashed */ 7 :global(.-child-cls-pXX_fA:hover .-nested-cls) { 8 color: green; 9 } 10 11 :global(html.night .-child-cls-pXX_fA .-nested-cls) { 12 color: blue; 13 } 14</style> 15 16<ChildComponent class="-child-cls-pXX_fA" />
The first class name that is prefixed with -
within :global()
will be hashed.
It's simply a find-replace operation. So you could pass the class names to other attributes. For example:
1<ChildComponent wrapperCls="-wrapper" contentCls="-content" />
And in child component, you can receive the class name as a normal prop:
ChildComponent.svelte:
1<script> 2 let className = ''; 3 export { className as class }; 4</script> 5 6<div class={className}> 7... 8</div>
Create a svelte.config.js
file in your project root folder with following contents:
1const cssHash = require('svelte-preprocess-css-hash') 2 3module.exports = { 4 preprocess: [ 5 cssHash() 6 ] 7}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
3 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 2
Reason
Found 0/23 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-01-27
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