Skip to main content
# 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)



Metadata

Release files for cssjson 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cssjson 1.0.0
File Size Uploaded
cssjson-1.0.0.tar.gz 3.7 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for cssjson 1.0.0
File Interpreter ABI Platform
cssjson-1.0.0-py3-none-any.whl Python 3 none any Details
cssjson-1.0.0-py2.7.egg Legacy Egg format - - Details

Total release size: 11.6 kB

Release files / cssjson-1.0.0.tar.gz

Download URL cssjson-1.0.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
edba865ed9560d5c76e53c52c5ecde86de32d9334c59068b53f8bfaad1cd65db
BLAKE2b-256 checksum
How to use checksums
d914cb1ef77ebbcbaffdf581941e434616316073a0167264a4dabdd0877d8206
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5

Release files / cssjson-1.0.0-py3-none-any.whl

Download URL cssjson-1.0.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
46b6e121a869b24a5822b240c8d04b3ed6d0d8b2ffe6ed549ab91384388c2ecc
BLAKE2b-256 checksum
How to use checksums
d2200a0c479849f421488a46753f58397565ff84fbdc7b75957401d21c630bf7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5

Release files / cssjson-1.0.0-py2.7.egg

Download URL cssjson-1.0.0-py2.7.egg
Size 4.1 kB
Tags Egg
SHA-256 checksum
How to use checksums
090206dec64d7aed8284e05bf7075d671055364c02e3495e02da81850623f01f
BLAKE2b-256 checksum
How to use checksums
f804ed099b4e51cf29a5eb3804926d0b0fa787aadbdda6578337495d4ca15f40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.5

Release history Release notifications | RSS feed

This release

1.0.0 This release

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page