Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
jss-camel-case
Advanced tools
The jss-camel-case npm package is a plugin for JSS (JavaScript Style Sheets) that converts camelCased property names to dash-separated (kebab-case) names. This is useful for writing CSS-in-JS styles in a more JavaScript-friendly syntax while ensuring compatibility with CSS standards.
Convert camelCase to kebab-case
This feature allows you to write styles in camelCase and have them automatically converted to kebab-case. In the example, `backgroundColor` and `fontSize` are converted to `background-color` and `font-size` respectively.
const jss = require('jss').default;
const camelCase = require('jss-camel-case').default;
jss.use(camelCase());
const styles = {
button: {
backgroundColor: 'blue',
fontSize: '14px'
}
};
const sheet = jss.createStyleSheet(styles).attach();
console.log(sheet.toString());
PostCSS is a tool for transforming CSS with JavaScript plugins. It can be used to convert camelCase to kebab-case among many other transformations. Unlike jss-camel-case, PostCSS is a more general-purpose tool and can be used for a wide range of CSS manipulations.
Styled-components is a library for writing CSS-in-JS with a focus on React. It allows you to write actual CSS syntax within JavaScript and supports camelCase properties. While it doesn't convert camelCase to kebab-case, it provides a similar developer experience by allowing you to write styles in a JavaScript-friendly way.
Emotion is a performant and flexible CSS-in-JS library. It supports writing styles in camelCase and automatically converts them to kebab-case. Emotion offers more features and flexibility compared to jss-camel-case, including theming and server-side rendering support.
Internally it converts everything back to dash separated names.
Make sure you read how to use plugins in general.
![Gitter](https://badges.gitter.im/Join Chat.svg)
import jss from 'jss'
import camelCase from 'jss-camel-case'
jss.use(camelCase())
let sheet = jss.createStyleSheet({
container: {
fontSize: '20px',
zIndex: 1,
lineHeight: 1.2
}
})
console.log(sheet.toString())
.jss-0-0 {
font-size: 20px;
z-index: 1;
line-height: 1.2;
}
console.log(sheet.classes)
{ container: "jss-0-0" }
File a bug against cssinjs/jss prefixed with [jss-camel-case].
npm i
npm run test
MIT
FAQs
JSS plugin that allows to write camel cased rule properties
We found that jss-camel-case demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.