Skip to main content

Converts CSS to JSON format

Project description

# CSSJSON :rocket:

A Python scripts that converts css to json. I usually use this when I do web scrapping and I need to scrape something from css using classnames or ids.

# Installation

## GitHub

```bash
$ git clone https://github.com/CITGuru/cssjson.git
$ cd cssjson
$ python setup.py install
```

## PyPI

```bash
$ pip install cssjson
```

# Usage

```python

from cssjson import toJSON, toCSS

json = toJSON("example.css", path=True)
print(json)
css = toCSS(json)
print(css)

```

# Methods

## toJSON (text, path, url)

Converts css to json and can either be a text, file or url.

### Text

```python
print(toJSON(".a{background:yellow}")
```

### Path

```python
print(toJSON("example.css", path=True)
```

### Url

```python
print(toJSON("https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css", url=True)
```

## toCSS (dict)

Converts json serialized css to css.

```python
print(toCSS({"rules":{}}))
```

# Contribution

You can contribute by sending a PR.

# Author

Oyetoke Toby (oyetoketoby80@gmail.com)



Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cssjson, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size cssjson-1.0.0-py2.7.egg (4.1 kB) File type Egg Python version 2.7 Upload date Hashes View
Filename, size cssjson-1.0.0-py3-none-any.whl (3.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size cssjson-1.0.0.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page