Skip to content

An awesome Swift CSS DSL library using result builders.

License

Notifications You must be signed in to change notification settings

andreasley/stylish

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stylish

A Swift CSS DSL library, based on swift-css.

let css = Stylesheet {            
    All {
        Background("#222")
    }
    Element(.div) {
        Color(.white)
        TextAlign(.left)
        Element(.p) {
            FontWeight(.bold)
        }
        Child {
	        Element(.span) {
	            BackgroundColor(.gray)
	        }
        }
	}
    Element(.input) {
        Pseudo(.focus) {
            BackgroundColor(.red)
        }
    }
    Media("only screen and (max-width: 600px)") {
        Id("custom-identifier") {
            Background("#222")
            Color(.cyan)
        }
        Class("custom-class") {
            Background("#333")
            Color(.aliceBlue)
        }
        Selector("ul > li > a") {
            Background("black")
            Color(.red)
                .important()
        }
        .pseudo(.hover)
    }
}
    
print(css.render())

Credits & references

About

An awesome Swift CSS DSL library using result builders.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Swift 100.0%