Skip to main content

High impact style sheets, empowered by python

Project description

Hyss - High Ympact Style Sheets

Rationale

Define styles as python dicts! All of the power of python, realised to create stylesheets. Coming soon to a package index near you!

Features

  • Create minified css content from a nested dictionary structure

  • Helper for compound css classes (think 'div p', 'main section')

Potential Future Features

  • Generate helpers for various css features. Already exist for animations.

  • Build an indenter for output css; ease of debugging for users

  • Means to convert

Usage Demonstrations

Here is a set of examples to illustrate the behaviour of functions within hyss

stylesheet(styles: dict) -> str

Takes a fractal dictionary structure and generates a minified css string as shown

from hyss import stylesheet

css = stylesheet(
        {
            'body': {
                'background-color': 'yellow',
            }, 
            'div': {
                'color': 'red'
            }
        }

print(css)

# This prints the following

# "body{background-color:yellow;}div{color:red;}"

with_linebreaks(css: str) -> str

Applies linebreaks to a minified css string, for debugging purposes as shown

from hyss.format import with_linebreaks

minified_css = "body{background-color:yellow;}div{color:red;}"

linebreak_css = with_linebreaks(minified_css)

print(linebreaks_css)

# This prints "body{\nbackground-color:yellow;\n}\ndiv{\ncolor:red;\n}\n"

In a file, linebreak_css will look as follows

body{
background-color:yellow;
}
div{
color:red;
}

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

hyss-2.0.0.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

hyss-2.0.0-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

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