https://github.com/strarsis/inline-styles-parse
Handles inline styles for consumption by a CSS parser that expects a full CSS rule instead.
https://github.com/strarsis/inline-styles-parse
Last synced: about 2 months ago
JSON representation
Handles inline styles for consumption by a CSS parser that expects a full CSS rule instead.
- Host: GitHub
- URL: https://github.com/strarsis/inline-styles-parse
- Owner: strarsis
- License: mit
- Created: 2015-11-03T20:10:45.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-03T20:36:34.000Z (over 9 years ago)
- Last Synced: 2025-05-09T04:37:18.312Z (about 2 months ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# inline-styles-parse
Handles inline styles for consumption by a CSS parser that expects a full CSS rule instead.[](https://travis-ci.org/strarsis/inline-styles-parse)
[](https://nodei.co/npm/inline-styles-parse/)
## Usage
````
npm install --save inline-styles-parse
````Prepare CSS rule for parsing from declarations (inline styles):
````
inlineStylesParse.declarationsToRule('padding:1em;');
=> '.dummy{padding:1em;}'
````Extract CSS declarations (inline styles) from stringified CSS rule:
````
inlineStylesParse.ruleToDeclarations('.dummy{padding:1em;}');
=> 'padding:1em;'
````## Methods
### declarationsToRule
Prepares a CSS rule from passed declarations.
#### declarations
The string of the CSS declarations.
#### selector
Optional selector name. Default is '.dummy'.### ruleToDeclarations
Extracts declarations from passed CSS rule.
#### rule
The string of the CSS rule.