Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
[![npm version](https://img.shields.io/npm/v/agile-css.svg)](https://www.npmjs.com/package/agile-css)
npm install agile-css
or
yarn add agile-css
const { pfs, rtl, stylesMap, validator } = require('agile-css');
module.exports = {
input: ["./src/**/*.jsx", "./src/**/*.js", "./src/**/*.tsx"],
output: "./src/agile-css.css",
defaultCss: `
body {
font-size: 14px;
}
`,
validator,
cache: true,
plugins: [pixelToRem(62.5), rtl(), pfs(), testplugin2()],
customValue(value) {
// customValue
console.log(value);
return value;
},
breakpoints: {
sm: "768px",
md: "992px",
lg: "1200px",
},
custom: {
"color-primary": "var(--color-primary)",
"color-secondary": "var(--color-secondary)",
"color-tertiary": "var(--color-tertiary)",
"color-quaternary": "var(--color-quaternary)",
},
};
function pixelToRem(rootFontSize) {
return ({ styles, addStyles }) => {
const newStyles = stylesMap(styles, (selector, css) => {
const [property, value] = css;
if (/[\d.]*px/g.test(value)) {
const newValue = value.replace(/[\d.]*px/g, (val) => {
const num = Number(val.replace("px", ""));
return `${(num * 62.5) / rootFontSize / 10}rem`;
});
const newCss = [property, newValue];
return {
[selector]: newCss,
};
}
return {
[selector]: css,
};
});
addStyles(newStyles);
};
}
// use pixelToRem: fz:14px -> css { font-size: ...rem }
function testplugin2() {
return ({ addBase }) => {
addBase(`.testttttttttt { color: red }`);
};
}
{
...
"scripts": {
...
"agile-css": "agile-css --port 4321",
"agile-css:watch": "yarn agile-css --watch"
},
...
}
npm run agile-css:watch
or yarn agile-css:watch
<property>:<value>|<pseudo>|<pseudo><important -> "!">...@<media>
Eg:
Class Name CSS
-----------------------------------------------------------------------------------------
c:red -> .c\:red { color: red }
bgc:blue! -> .bgc\:blue\! { background-color: blue !important }
bd:1px_solid_yellow -> .bd\:1px_solid_yellow { border: 1px solid yellow }
p:30px@md -> @media (min-width:992px) { .p\:30px\@md { padding: 30px }
m:20px@+300px -> @media (max-width:300px) { .m\:20px\@\+300px { margin: 20px } }
fz:20px|h -> .fz\:20px\|h:hover { font-size: 20px }
cnt:(After_cnt)||af -> .cnt\:\(After_cnt\)\|\|af::after { content: 'After ctn' }
cnt:(Before_cnt)|be -> .cnt\:\(Before_cnt\)\|be:before { content: 'Before ctn' }
cnt:(Hover)|h||be -> .cnt\:\(Hover\)\|be:hover:before { content: 'Hover' }
trf:scale(2) -> .trf/:scale\(2\) { transform: scale(2) }
m:calc(20px_+_10px) -> .m\:calc\(20px_+_10px\) { margin: calc(20px + 10px) }
<div class="c:red c:blue|h bgc:color-primary fz:20px ml:10px w:30%@md p:30px@md m:20px@+300px pos:relative!"></div>
.c\:red { color: red }
.c\:blue\|h:hover { color: blue }
.bgc\:color-primary { background-color: var(--color-primary) }
.fz\:20px { font-size: 20px }
.ml\:10px { margin-left: 10px }
[dir="rtl"] .ml\:10px { margin-right: 10px }
.pos\:relative\! { position: relative !important }
@media (max-width:300px) {
.m\:20px\@\+300px { margin: 20px } }
@media (min-width:992px) {
.p\:30px\@md { padding: 30px }
.w\:30\%\@md { width: 30% } }
import { atomic, validator } from 'agile-css';
atomic.setConfig({
breakpoints: {
sm: '768px',
md: '992px',
lg: '1200px',
},
cache: true,
parentSelector: '',
exclude: [],
custom: {
'color-primary': 'var(--color-primary)',
'color-secondary': 'var(--color-secondary)'
},
validator,
});
atomic.plugins([rtl(), pfs()]);
atomic.customValue(value => {
console.log(value);
return value;
});
atomic
.find(`<div class="c:red c:blue|h fz:20px w:30%@md p:30px@md m:20px@+300px pos:relative!"></div>`);
.find(`const className = "bgc:blue";`);
const id = atomic.on('success', css => {
console.log(atomic.getCss());
});
// atomic.off(id);
atomic.on('valid', diagnostic => {
console.log(diagnostic);
});
atomic.on('invalid', diagnostic => {
console.log(diagnostic);
});
FAQs
[![npm version](https://badge.fury.io/js/agile-css.svg)](https://badge.fury.io/js/agile-css) [![npm](https://img.shields.io/npm/dw/agile-css.svg?logo=npm)](https://www.npmjs.com/package/agile-css) [![npm](https://img.shields.io/bundlephobia/minzip/agile-c
The npm package agile-css receives a total of 46 weekly downloads. As such, agile-css popularity was classified as not popular.
We found that agile-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
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.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.