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-fruit
Advanced tools
Readme
A Parser and Analysis of CSS Declaration.
npm install --save-dev css-fruit
import Fruit from 'css-fruit';
const background = Fruit.absorb('background', 'url(abc.png) #eee right top / 100% repeat-x');
CommonJS Code
const Fruit = require('css-fruit').default;
const background = Fruit.absorb('background', 'url(abc.png) #eee right top / 100% repeat-x');
Following is the structure of generated backgroud object:
background: Background {
valid: true,
color: #eee,
image: 'url(\'abc.png\')',
position: BackgroundPosition {
valid: true,
x: { origin: 'right', offset: undefined },
y: { origin: 'top', offset: undefined },
},
size: BackgroundSize {
valid: true,
width: '100%',
height: 'auto',
},
repeat: BackgroundRepeat {
valid: true,
x: 'repeat',
y: 'no-repeat',
},
attachment: undefined,
origin: undefined,
clip: undefined
}
Make sure props of declarations related to same shorthand.
import Fruit from 'css-fruit';
const background = Fruit
.absorb('background', 'url(abc.png) #eee repeat-x')
.absorb('background-size', '100%')
.absorb('background-position', 'top right');
An object like postcss decl struct is allowed:
import Fruit from 'css-fruit';
const background = Fruit
.absorb({ prop: 'background', value: 'url(abc.png) #eee repeat-x' })
.absorb({ prop: 'background-size', value: '100%' })
.absorb({ prop: 'background-position', value: 'top right' });
You can pass an Array also.
import Fruit from 'css-fruit';
const background = Fruit.absorb([
{ prop: 'background', value: 'url(abc.png) #eee repeat-x' },
{ prop: 'background-size', value: '100%' },
{ prop: 'background-position', value: 'top right' }
]);
If you want process CSS properties only about background in your project, it is better to import as required.
import { Background } from 'css-fruit';
const background = Background
.absorb('background', 'url(abc.png) #eee repeat-x')
.absorb('background-size', '100%')
.absorb('background-position', 'top right');
npm run build
npm run test
See Releases
FAQs
A Parser and Analysis of CSS Declaration
The npm package css-fruit receives a total of 205 weekly downloads. As such, css-fruit popularity was classified as not popular.
We found that css-fruit 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.