css-fruit
A Parser and Analysis of CSS Declaration.
Features
- Can set parse depth
- Chained call
- ...
Install
npm install --save-dev css-fruit
Example
Quickstart
;const background = Fruit;
CommonJS Code
const Fruit = default;const background = Fruit;
Following is the structure of generated backgroud object:
background: Backgroundvalid: truecolor: #eeeimage: 'url(\'abc.png\')'position: BackgroundPositionvalid: truex: origin: 'right' offset: undefinedy: origin: 'top' offset: undefinedsize: BackgroundSizevalid: truewidth: '100%'height: 'auto'repeat: BackgroundRepeatvalid: truex: 'repeat'y: 'no-repeat'attachment: undefinedorigin: undefinedclip: undefined
Chained call
Make sure props of declarations related to same shorthand.
;const background = Fruit;
Decl or Array
An object like postcss decl struct is allowed:
;const background = Fruit;
You can pass an Array also.
;const background = Fruit;
import as required
If you want process CSS properties only about background in your project, it is better to import as required.
;const background = Background;
Develop
build
npm run build
test
npm run test
Changelog
See Releases