Introducing Myth – New CSS guy in the market!

Myth is a postprocessor that lets you write pure CSS without having to worry about slow browser support, or even slow spec approval. It’s like a CSS polyfill.

It lets you write pure CSS while still giving you the benefits of tools like LESS and Sass. You can still use variables and math functions, just like you do in preprocessors. It’s like a polyfill for future versions of the spec.

Some of the features in CSS require runtime calculations, which neither Myth nor preprocessors handle, but what Myth does is let you write your code today in the future syntax, so that your code is future-proof. When browsers finally support these features you won’t need to rewrite anything, just remove Myth and start using the cascade!

Taking plain CSS as an input also means you can use Myth to post-process anyone else’s CSS (or another preprocessor’s output), adding the browser support you need, without having to re-write the code in a completely different syntax.

Myth is built with Rework so it’s incredibly fast, and has a nice Javascript API in addition to the CLI.

Following are some examples that are demonstrated in Myth website.

Variables:
The same syntax from the CSS spec, using the var() function.

[code language=”css”]
:root {
var-purple: #847AD1;
var-large: 10px;
}a {
color: var(purple);
}pre {
padding: var(large);
}
[/code]
[code language=”css”]
:root {
var-purple: #847AD1;
var-large: 10px;
}a {
color: #847AD1;
}pre {
padding: 10px;
}
[/code]

Math:
The same syntax from the CSS spec, using the calc() function.

[code language=”css”]
pre {
margin: calc(var(large) * 2);
}
[/code]
[code language=”css”]
pre {
margin: 20px;
}
[/code]

No Prefixes:
Prefixes for common browsers are automatically added, so you don’t need worry.

[code language=”css”]
a {
transition: color .2s;
}
[/code]
[code language=”css”]
a {
-webkit-transition: color .2s;
transition: color .2s;
}
[/code]

You can fork the API on GitHub.

Source: http://www.myth.io/

Leave a Comment

Your email address will not be published. Required fields are marked *