Gathering detailed insights and metrics for svelte-preprocess-css-hash
Gathering detailed insights and metrics for svelte-preprocess-css-hash
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
TypeScript (95.95%)
JavaScript (4.05%)
Total Downloads
2,859
Last Day
1
Last Week
11
Last Month
29
Last Year
546
MIT License
9 Stars
23 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Nov 21, 2024
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
Published on
Nov 21, 2024
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
450%
11
Compared to previous week
Last Month
-39.6%
29
Compared to previous month
Last Year
-18.4%
546
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
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/23 approved changesets -- score normalized to 0
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-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