CSS Minify API version

Minifying CSS from an input string or urls.

.Maui CSS Minify API for minifying CSS documents from an input string or urls.

POSTGET *
https://api.dotmaui.com/client/1.2/cssmin/

Parameters

Field Type Description Required
apikey String

.Maui Api key

True

css String

CSS valid code

1

url String

Valid URL to a CSS file

1

url[] String[]

One or more valid URL to CSS files

1

removeurlquotes Boolean

Removes quotes from urls. Default is true.

False

removecomments Boolean

Removes all comments. Default is true.

False

sortproperties Boolean

Sort CSS properties alphabetically. Default is false.

False

wrapcsslines Boolean

Wrap lines at 80 characters. Default is false.

False

mode String

Accepted values are:

  • default (default), the result of the operation will be the minified file as string

  • cdn, the minimized file will be saved in .Maui's cdn

False

name String

The name of the file that will be saved in the CDN. Ignored in default mode.

False

1 There must be one of these values

 

Success 200 - Default Mode

It will be a string with the CSS code minimized

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

 

Success 200 - CDN Mode

Field Type Description
url String

The url where the minimized file was saved

size Integer

File size in bytes

UID String

Unique alphanumeric ID in the .Maui CDN

HTTP/2.0 200 OK         
{
    "url": "https://cdn.dotmaui.com/dotmaui/css/mystyle.min.css", 
    "size": 51913, 
    "UID": "d9dju4"
}

Examples

import urllib.parse
import urllib.request

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

div {
    border: 1px solid red;
}

p,
span {

    font-weight: bold;
    font-size: 15px

}

"""

params = urllib.parse.urlencode({'apikey': 'YOUR_API_KEY', 'css': css_string}).encode("utf-8")
minified = urllib.request.urlopen("https://api.dotmaui.com/client/1.2/cssmin/", data = params).read().decode("utf-8")

print(minified) #body{background-color:#000}div{border:1px solid red}p,span{font-weight:bold;font-size:15px}
<?php

$data = array('apikey' => 'YOUR_API_KEY', 
              'url' => "https://dotmaui.com/assets/css/default.min.css");

$curl = curl_init("https://api.dotmaui.com/client/1.2/cssmin/");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); 

$output = curl_exec($curl);  

curl_close($curl);

echo $output;

* Only for premium users.