@tmcw / MapBox
# npm install -g carto carto project.mml
/* hello, this is carto */
#dots {
marker-width: 1;
marker-fill: #f00;
marker-line-width: 0;
}
CartoCSS is code, so you can use your friends
because that is how we learn
It was designed for Mapnik, it's one and only
don't tempt me, you know where this could go
CartoCSS resembles CSS to avoid the Gumption Trap
'Can I Approach This?'
#world {
::foo {
polygon-opacity:1;
}
marker-width:[foo];
}
vs
div {
background:#f00;
}
@variables: 'yes';
.nesting { .selectors { } }
// c++ style comments
spin(2, 2, 2);
CartoCSS is written in Javascript and runs primarily under node.js.
It can and has run in browsers instead, but there are no good renderers written for browsers yet and I'm not going to get into it.
CartoCSS tokenizes source, turns it into an AST, 'flattens' that AST, doing the work of inheritance, descendent selectors, expression evaluation, and so on.
The end result of this hard work is a flattened AST. Which is converted into the XML format Mapnik, the only supported renderer, uses.
/* can you see the assumption? */
#foo[zoom > 3] {
color: red;
}
/* the assumption: */
/* 3 = a zoom level
in spherical mercator */
#foo[zoom > 3] {
color: red;
}
many tears have been shed making sure your save click does not pause your mind
error reporting is the most underrated part of interpreters in general.