Get Started
Stylify is a library that uses CSS-like selectors to generate optimized utility-first CSS on demand. Stylify processes content (of a file for example), finds class selectors and generates CSS for them. Then it does some optimization and generates CSS files.
All you have to do in order to start using Stylify is to install it and write CSS-like selectors into class attributes. No configuration required. You don’t have to create any CSS files, add any configuration or study anything. If you know CSS a bit, you already know, how to use Stylify.
However, if you want, you can use other features like Variables, Components, Macros and Custom selectors. More about them below.
Stylify CSS doesn’t ship with any “Fancy Pants” shortcuts, color themes and predefined typography. You might be asking why, so here are a few explanations for start:
- Shortcuts: They are hard to remember and impractical. Yes, using them means less typing and shorter class attributes for the cost of studying syntax (which is easy to forget) and increased complexity.
- Color palettes: Stylify doesn’t provide any because they doesn’t match design needs in most cases. When working on a project, you will also have to get them from project designer, downloaded theme or generate them on your own using some tool like Material Theme Builder.
- Typography: The same as color palettes. You can find some typography tools and assets and typography snippets in Stlyify docs.
- To sum it up, the goal is to stick as much as possible with the native CSS syntax without unnecessary predefined configuration that is practically useless and overvalued.
Installation
Stylify can work with any tool. For some of them it have its own integration. If you havent found your favorite let us know.
Quick Start
The easiest way to start is to play within the editors below or copy the examples and test it within the Codepen Playground.
Syntax is similar to CSS property:value with a few differences:
- Use
_(one underscore) for a space and^(a hat) for a quote - To preserver underscore or a hat character, use
\(a backslash) =>\_ - For vendor prefixes
-webkit,-moz, do not add-(a hyphen) at the beginning - The default syntax pattern is
<screen>:<pseudo classes>:<property>:<value>. Sceens and pseudo classes are optional
color:blue => blue color
hover:color:blue => blue color after hover
lg:color:blue => blue color for from selected screen
lg:hover:color:blue => blue color after hover from selected screen
webkit-font-smoothing:antialiased
When a lot of properties repeats for the same screen or pseudo class, you can group them like in the example below. The syntax is <screen>:<pseudo classes>:{stylify selectors split by ;}
hover:{color:blue;font-weight:bold} # Shortcut for multiple selectors
lg:hover:{color:blue;font-weight:bold} # The same but also for screen
<!--
Edit Me 😎!
Write selectors as CSS property:value
Use _ for a space and ^ for a quote
-->
<img src="/images/p1.jpg" class="
height:120px
width:auto
border-radius:4px
transition:.3s
hover:scale:1.1
"><!-- Edit Me 😎! Write selectors as CSS property:value Use _ for a space and ^ for a quote --> <img src="/images/p1.jpg" class=" height:120px width:auto border-radius:4px transition:.3s hover:scale:1.1 ">
.border-radius\:4px{
border-radius: 4px
}
.height\:120px{
height: 120px
}
.hover\:scale\:1\.1:hover{
scale: 1.1
}
.transition\:\.3s{
transition: .3s
}
.width\:auto{
width: auto
}.z{
border-radius: 4px
}
.zp{
height: 120px
}
.zo:hover{
scale: 1.1
}
.dr{
transition: .3s
}
.cw{
width: auto
}<!-- Edit Me 😎! Write selectors as CSS property:value Use _ for a space and ^ for a quote --> <img src="/images/p1.jpg" class=" zp cw z dr zo ">