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.

Source Distribution

cssjson-1.0.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distributions

cssjson-1.0.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

cssjson-1.0.0-py2.7.egg (4.1 kB view details)

Uploaded Source

File details

Details for the file cssjson-1.0.0.tar.gz.

File metadata

  • Download URL: cssjson-1.0.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for cssjson-1.0.0.tar.gz
Algorithm Hash digest
SHA256 edba865ed9560d5c76e53c52c5ecde86de32d9334c59068b53f8bfaad1cd65db
MD5 3ace100dd875757aa1c2b938d557d61e
BLAKE2b-256 d914cb1ef77ebbcbaffdf581941e434616316073a0167264a4dabdd0877d8206

See more details on using hashes here.

File details

Details for the file cssjson-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cssjson-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for cssjson-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46b6e121a869b24a5822b240c8d04b3ed6d0d8b2ffe6ed549ab91384388c2ecc
MD5 48cd9168627c6a444ddc7d386719cd95
BLAKE2b-256 d2200a0c479849f421488a46753f58397565ff84fbdc7b75957401d21c630bf7

See more details on using hashes here.

File details

Details for the file cssjson-1.0.0-py2.7.egg.

File metadata

  • Download URL: cssjson-1.0.0-py2.7.egg
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for cssjson-1.0.0-py2.7.egg
Algorithm Hash digest
SHA256 090206dec64d7aed8284e05bf7075d671055364c02e3495e02da81850623f01f
MD5 e4fa68c7ceb98b8b33e9566fd579285a
BLAKE2b-256 f804ed099b4e51cf29a5eb3804926d0b0fa787aadbdda6578337495d4ca15f40

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page