Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • BackTrack 5 R2
  • Wine 1.4 / 1.5.5
  • Mozilla Firefox 12...
  • Ubuntu 11.04
  • Angry Birds 1.1.2.1
  • Ubuntu 10.04.4 LTS
  • Linux Kernel 3.4
  • Ubuntu Manual 10.10
  • Adobe Flash Player...
  • Pidgin 2.10.4
  • Home > Linux > Internet > HTTP (WWW)

    CleanCSS 1.4

    Download button

    No screenshots available
    Downloads: 233  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Massimiliano Torromeo | More programs
    BSD License / FREE
    April 19th, 2011, 09:49 GMT
    ROOT / Internet / HTTP (WWW)

     Read user reviews (0)  Refer to a friend  Subscribe

    CleanCSS description

    Pythonic markup for CSS

    CleanCSS is a simple pythonic language for CSS inspired by CleverCSS but simpler and with less obstructive features.

    Why

    I really liked the idea behind CleverCSS but when used in production I realized that I was trying to get away from its parser by escaping strings and unsupported CSS properties way too often. Using vendor prefixes like -webkit-gradient and values such as rgba resulted in a messy CSS, so I decided to write my own parser for a similar syntax without all the complex features that I did not use anyway and it now works fine for me in REAL modern websites.

    Syntax examples

    I'm going to keep the CleverCSS examples where possible since the syntax is really similar.

    A small example below. Note the indentation based syntax and how you can nest rules:

    #header, #footer:
            margin: 0
            padding: 0
            font->
                    family: Verdana, sans-serif
                    size: .9em

            li:
                    padding: 0.4em
                    margin: 0.8em 0 0.8em

                    h3:
                            font-size: 1.2em
                    p:
                            padding: 0.3em
                    p.meta:
                            text-align: right
                            color: #ddd


    Of course you can do the very same in CSS, but because of its flat nature the code would look more verbose. The following piece of code is the CleanCSS output of the above file:

    #header, #footer {
            margin: 0;
            padding: 0;
            font-family: Verdana, sans-serif
            font-size: .9em
    }

    #header li,
    #footer li {
            padding: 0.4em;
            margin: 0.8em 0 0.8em;
    }

    #header li h3,
    #footer li h3 {
            font-size: 1.2em;
    }

    #header li p,
    #footer li p {
            padding: 0.3em;
    }

    #header li p.meta,
    #footer li p.meta {
            text-align: right;
            color: #dddddd;
    }


    Library usage

    Import the cleancss module and call the convert() function with a file-like object.

    Example:

    import cleancss
    with open('file.css') as f:
            print cleancss.convert(f)


    Command line usage

    Call the cleancss.py without parameters to show the usage instructions. Pass any number of files to cleancss.py and the script will convert the files to CSS and print the result to the console.

    Example:

    cleancss.py file.css > result.css


    Product's homepage

    Requirements:

    · Python

      


    TAGS:

    CSS markup | CSS cleaner | CSS | cleaner | markup



    HTML code for linking to this page:


    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM