Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
css-in-js
Advanced tools
Readme
Write stylesheets in JS.
Works with any stack.
There are many ways of writing styles as JS (Free Style, restyle and babel-plugin-css-in-js – just to name a few). But none of them has the option to compile to a good old interoperable CSS stylesheet, or the new and shiny CSS module. I wanted an easy way to take advantage of JS goodness when writing stylesheets – a way compatible with any tech stack.
npm install [--save] css-in-js
const cssInJs = require('css-in-js');
const indigo = '#3F51B5';
▸ cssInJs({
'.my-button': {
'width': '50px',
'background-color': indigo,
},
'@media screen and (min-width: 80em)': {
'.my-button': {
'width': '100%',
},
},
});
◂ `
.my-button {
width: 50px;
background-color: #3F51B5;
}
@media screen and (min-width: 80em) {
.my-button {
width: 100%;
}
}
`
Any JS object is translated recursively to a CSS tree. To ensure two-way compatibility, we only support git.io/orthodox style objects.
When using fancy things which need a CSS fallback, you might want to set the same property more than once:
.drag-me {
cursor: pointer;
cursor: -webkit-grab;
cursor: grab;
}
To cover these cases, we allow passing an array of style objects:
▸ cssInJs({
'.drag-me': [{
cursor: 'pointer',
}, {
cursor: '-webkit-grab',
}, {
cursor: 'grab',
}],
});
◂ `
.drag-me {
cursor: pointer;
cursor: -webkit-grab;
cursor: grab;
}
`
css-in-js is heavily inspired by the great elm-css by Richard Feldman. The name is inspired by the disrupting React talk CSS in JS by Christopher Chedeau.
FAQs
Write stylesheets in JS. Works with any stack.
The npm package css-in-js receives a total of 3 weekly downloads. As such, css-in-js popularity was classified as not popular.
We found that css-in-js 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.