
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@artifact-project/css
Advanced tools
Yet another CSS in JS
import css, {getUsedCSS} from '@artifact-project/css';
const cx = css({
'main': {
color: 'red',
fontSize: 14,
},
});
console.log(cx.main); // "main-nssjx7" (dev)
console.log(cx.main); // "_rs" (production)
console.log(getUsedCSS());
// {
// names: ['nssjx7'],
// cssText: '._nssjx7{color:red;font-size:14px;}',
// }
Add style#__css__ into head and before including @artifact-project/css.
<style id="__css__" data-names="%__USED_CSS_NAMES__%">%__USED_CSS_TEXT__%</style>
<script type="module">
import css from './node_modules/@artifact-project/css/index.js';
const cx = css({
'link': {
color: '#3c0',
'&:hover': {
color: 'red',
},
},
});
</script>
css(rules): {[name:string]: string}fx(keyframes): (detail: string) => objectgetUsedCSS(all?: boolean): {names: string[], cssText: string}Deduplication & critical css.
import css, {getUsedCSS} from '@artifact-project/css';
const some = css({
'main': {
color: '#333',
fontSize: 14,
},
});
// Keyframes animation
const colorFx = css.fx({
from: {color: '#333'},
to: {color: 'red'},
});
// Some unused fx
const unusedFx = css.fx({
from: {top: 0},
to: {top: 300},
});
const link = css({
'root': {
color: '#333',
fontSize: 14,
'&:hover': {
animation: colorFx('0.3s'),
},
},
'unused': {
textAlign: 'center',
},
});
console.log(some.main); // "_rs" (1)
console.log(link.root); // "_rt" (2)
// and CSS result, wow! (3)
console.log(getUsedCSS().cssText);
// @keyframes _xsdcv{from:{color:#333}to:{color:red}}
// ._rs, _rt{color:#333;font-size:14px;}
// ._rs:hover{animation:_xsdcv 0.3s;}
'production' | 'dev''server' | 'client'npm inpm test, code coverageFAQs
Yet another CSS in JS
The npm package @artifact-project/css receives a total of 3 weekly downloads. As such, @artifact-project/css popularity was classified as not popular.
We found that @artifact-project/css 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
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.