GithubHelp home page GithubHelp logo

cssoj's Introduction

cssoj

A Clojure library designed to generate css using clojure code, under construction

Now supports:

  • generate raw styles using (style ...) function, e.g:
(style {:background :#FFF :color :#333}
       [:padding :10px :margin :5px]
	   "float: left; text-align: center;")
generates
background:#FFF; color:#333; padding:10px; margin:5px; float:left; text-align:center;
  • build mixin styles using (style ...) function, e.g:
(defn test-style [float]
;;;this defines a function with an arg "float"
  (style [:float float :text-align center]))

(style 
  (style {:background :#FFF :color :#333}
         [:padding :10px])
  [:margin :5px]
  (test-style :left))

generates

background:#FFF; color:#333; padding:10px; margin:5px; float:left; text-align:center;
  • apply style on certain selector(s), with nested rules, e.g:
(apply-to 
  [:#test-div [{:background :#FFF :color :#333}
               [:padding :10px :margin :5px]]]
  [:#test-div2 [[:background :#DDD :color :#000]]
   [:ul [[:margin :10px]]
    [:li [(test-style :left)]]]])

generates

#test-div{background:#FFF; color:#333; padding:10px; margin:5px;}
#test-div2{background:#DDD; color:#000}
#test-div2 ul{margin:10px;}
#test-div2 ul li{float:left; text-align:center;}
  • prtettify the output e.g
(println
  (prettify
    (apply-to 
      [:#test-div [{:background :#FFF :color :#333}
                   [:padding :10px :margin :5px]]]
      [:#test-div2 [[:background :#DDD :color :#000]]
       [:ul [[:margin :10px]]
        [:li [(test-style :left)]]]])))

outputs

#test-div{
  background:#FFF; 
  color:#333; 
  padding:10px; 
  margin:5px;

}

#test-div2{
  background:#DDD; 
  color:#000

}

#test-div2 ul{
  margin:10px;

}

#test-div2 ul li{
  float:left; 
  text-align:center;

}
  • useful css3 helpers(under construction) e.g:
(println 
  (prettify
    (apply-to [:div#testcss3
               (css3/transform :translate ["1px" "2px"] 
                               :rotate [30 60 30] 
                               :scale ["50%" "70%" "90%"]
                               :persp 50
                               :backface true)])))

outputs

div#testcss3 {
  -ms-backface-visibility: visible;
   -moz-backface-visibility: visible;
   backface-visibility: visible;
   -webkit-backface-visibility: visible;
   perspective: 50;
   -webkit-perspective: 50;
   transform-style: preserve-3d;
   -webkit-transform-style: preserve-3d;
   -o-transform: translate(1px,2px) rotateX(30deg) rotateY(60deg) rotateZ(30deg) scale3d(50%,70%,90%) ;
   -moz-transform: translate(1px,2px) rotateX(30deg) rotateY(60deg) rotateZ(30deg) scale3d(50%,70%,90%) ;
   transform: translate(1px,2px) rotateX(30deg) rotateY(60deg) rotateZ(30deg) scale3d(50%,70%,90%) ;
   -webkit-transform: translate(1px,2px) rotateX(30deg) rotateY(60deg) rotateZ(30deg) scale3d(50%,70%,90%) ;
   -ms-transform: translate(1px,2px) rotateX(30deg) rotateY(60deg) rotateZ(30deg) scale3d(50%,70%,90%) ;
   
}

README NOT FINISHED... THERE ARE MORE....

Usage

TODO: WRITE THIS

License

Copyright © 2013 clyce

Distributed under the Eclipse Public License, the same as Clojure.

cssoj's People

Contributors

clyce avatar

Stargazers

45739847 avatar Kvar Izunia avatar cl avatar  avatar Z-Shang avatar WÁNG Xuěruì avatar  avatar snake avatar Hao Shi avatar Jury Schon avatar WANG Yanjin avatar Yin Zhong avatar

Watchers

 avatar Hao Shi avatar

Forkers

z-shang

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.