Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 13 days 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 (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-11-03T20:36:34.000Z (about 9 years ago)
- Last Synced: 2024-10-28T15:03:48.231Z (22 days ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 0
- Watchers: 3
- 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.[![Build Status](https://travis-ci.org/strarsis/inline-styles-parse.svg)](https://travis-ci.org/strarsis/inline-styles-parse)
[![NPM](https://nodei.co/npm/inline-styles-parse.png?downloads=true&downloadRank=true&stars=true)](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.