Git Product home page Git Product logo

escssparser's Introduction

ESCssParser

ESCssParser is a css parser for Objective-C. you can use it to parser some simple CSS to NSDictionary.

###how to use:

ESCssParser *parser = [[ESCssParser alloc] init];
NSDictionary *styleSheet = [parser parseText:cssText];
NSLog(@"styleSheet: %@", styleSheet);

###css file:

/*this file is just for test*/
@charset "utf-8";

*{ margin:5px 10px; font-size:17px; color:rgb(200,200,200); }

#idSelector{
    background-image:url(../images/someImg.png);
    width:200px;
    height:150px;
}

.classSelector{
    display: black;
    border-width: 5px;
    border-color: #ababab;
    border-radius: 8px;
    
    -webkit-animation-name: myAnimation;
    -webkit-animation-duration:3s;
    -webkit-animation-timing-function:ease-in-out;
    -webkit-animation-iteration-count:3;
}

@-webkit-keyframes myAnimation{
    from{ width:500px; height:400px; background-color:red;}
    to{width:300px; height:200px; background-color:#fff;}
}

div{
    padding-left:5px;
    padding-top:10px;
    text-align:center;
}

###result:

styleSheet: {
    "#idSelector" =     {
        "background-image" = "url(../images/someImg.png)";
        height = 150px;
        width = 200px;
    };
    "*" =     {
        color = "rgb(200, 200, 200)";
        "font-size" = 17px;
        margin = "5px 10px";
    };
    "-webkit-keyframes myAnimation" =     {
        from =         {
            "background-color" = red;
            height = 400px;
            width = 500px;
        };
        to =         {
            "background-color" = "#fff";
            height = 200px;
            width = 300px;
        };
    };
    ".classSelector" =     {
        "-webkit-animation-duration" = 3s;
        "-webkit-animation-iteration-count" = 3;
        "-webkit-animation-name" = myAnimation;
        "-webkit-animation-timing-function" = "ease-in-out";
        "border-color" = "#ababab";
        "border-radius" = 8px;
        "border-width" = 5px;
        display = black;
    };
    div =     {
        "padding-left" = 5px;
        "padding-top" = 10px;
        "text-align" = center;
    };
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.