Vulture CSS API version

Optimize and remove unused CSS from an input string or url

These APIs minimize and optimize the CSS passed as a string or as a url, if HTML code or an HTML url is also specified only the CSS rules used will be returned.

POSTGET *
https://api.dotmaui.com/client/1.1/vulturecss/

Parameters

Field Type Description Required
apikey String

.Maui Api key

True

css String

CSS valid code

1

cssurl String

Valid URL to a CSS file

1

html String

HTML valid code

False

htmlurl String

Valid URL to a HTML file

False

purge Boolean

If true, use CSS Purge to optimize CSS.

2

1 There must be one of these values

2 True if no HTML is provided, default is False

 

Success 200 - Default Mode

It will be a string with the CSS code optimized and minimized.

HTTP/1.1 200 OK         
body{background-color:#000}div{border:1px solid red}p,span{font-weight:bold;font-size:15px}

 


Examples

import urllib.parse
import urllib.request

html_string = """
<body>
    <p class=blue>Blue</p>
    <p class=red>Red</p>    
</body>
"""

css_string = """ 
body {
    background-color: #000000;
}

div {
    border: 1px solid red;
}

a {
    font-weight: bold;
    font-size: 15px
}

.red {
    color: red;
}

.blue {
    color: blue;
}

.pink {
    color: pink;
}

"""

params = urllib.parse.urlencode({'apikey': 'YOUR_API_KEY', 'html': html_string, 'css': css_string, 'purge': 'true'}).encode("utf-8")
optimized = urllib.request.urlopen("https://api.dotmaui.com/client/1.1/vulturecss/", data = params).read().decode("utf-8")

print(optimized) 
# Result:
# body{background-color:#000}.red{color:red}.blue{color:#00f}

* Only for premium users.