Gathering detailed insights and metrics for aphrodite-jss
Gathering detailed insights and metrics for aphrodite-jss
Gathering detailed insights and metrics for aphrodite-jss
Gathering detailed insights and metrics for aphrodite-jss
npm install aphrodite-jss
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
92 Stars
47 Commits
17 Forks
8 Watching
1 Branches
59 Contributors
Updated on 18 Sept 2024
Minified
Minified + Gzipped
JavaScript (68%)
HTML (32%)
Cumulative downloads
Total Downloads
Last day
45.3%
539
Compared to previous day
Last week
-4.3%
1,662
Compared to previous week
Last month
191.4%
4,905
Compared to previous month
Last year
-51.9%
19,404
Compared to previous year
3
22
This project is a merge of good ideas from aphrodite and JSS. It provides an API of aphrodite but fixes lots of limitations and caveats by using JSS as a rendering engine under the hood.
css()
function invocation. Only the passed rules are converted to a CSS string and injected.css()
call invocation. It gives you an access to computed styles right after render, no need to use setTimeout()
. It also avoids additional recalcs and repaints, which can cause flickers and general performance overhead.1import {StyleSheet, css} from 'aphrodite-jss' 2 3const sheet = StyleSheet.create({ 4 button: { 5 border: '1px solid', 6 borderRadius: 5, 7 fontSize: 'inherit', 8 lineHeight: '2.3em', 9 padding: '0 1em', 10 boxShadow: 'inset 0 1px 0 rgba(255, 255, 255, 0.1)', 11 textShadow: '0 -1px 0 rgba(0, 0, 0, 0.25)', 12 backgroundRepeat: 'repeat-x', 13 color: '#fff', 14 fontWeight: 400, 15 '& span': { 16 marginRight: 5, 17 color: '#fff' 18 } 19 }, 20 primary: { 21 borderColor: '#1177cd #0f6ab6 #0d5c9e', 22 backgroundImage: 'linear-gradient(to bottom, #2591ed 0%, #1177cd 100%)', 23 backgroundColor: '#1385e5', 24 '&:hover': { 25 backgroundImage: 'linear-gradient(to bottom, #3c9def 0%, #1385e5 100%)' 26 } 27 } 28}) 29 30document.body.innerHTML = ` 31 <button class="${css(sheet.button, sheet.primary)}"> 32 <span>✔</span>Primary 33 </button> 34`
StyleSheet.create(styles)
Create function doesn't render anything, it just registers your styles.
Returns an object, where key names correspond the original styles obejct.
css(rule1, [rule2], [rule3], ...)
Injects a previously defined rule to the dom. This is done in sync, so the CSS rule is immediately available.
Returns a class name.
The format for styles is defined in jss. Aprodisiac uses jss-preset-default, so all default presets are already in place.
aphroditeJss(jss, [options])
You can pass your own JSS instance with your custom setup.
Returns aphrodite's interface.
1import aphroditeJss from 'aphrodite-jss' 2import {create} from 'jss' 3 4const {css, StyleSheet} = aphroditeJss(create())
There are 2 functions you need to know - toString()
and reset()
.
As aphrodite-jss can not know that you are rendering a new response, you need to get the CSS (toString()
) when you are processing the first request and call reset()
to clean up the styles your current page has produced.
1import {toString, reset} from 'aphrodite-jss' 2 3function render() { 4 const app = renderApp() 5 const css = toString() 6 reset() 7 8 return ` 9 <head> 10 <style> 11 ${css} 12 </style> 13 <head> 14 <body> 15 ${app} 16 </body> 17 ` 18}
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 5/19 approved changesets -- score normalized to 2
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
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
77 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-25
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