This repository has been archived and is no longer actively maintained.
This project was last updated on 2017-10-25 and is preserved for historical reference only.
- 🔒 Read-only: No new issues, pull requests, or changes will be accepted
- 📦 No support: This code is provided as-is with no support or updates
- 🔍 For reference only: You may fork this repository if you wish to continue development
For current CARTO projects and actively maintained repositories, please visit: https://github.com/CartoDB
Generate CartoCSS and Turbocarto ramps from a JavaScript object
$ npm install cartojss
var cartojss = require('cartojss');
var style = {
'@small': 3,
'@large': 6,
'#layer': {
'marker-width': '@small',
'marker-allow-overlap': true,
'[zoom = 4]': {
'marker-width': '@large'
}
},
'#selector': {
'line-dasharray': [1, 4, 2],
'marker-width': 'ramp([price], (10, 20, 30), jenks())'
},
'#world': {
'text-name': '"[NAME]"',
'text-size': 11,
'text-face-name': ['"Georgia Regular"', '"Arial Italic"']
}
}
cartojss.serialize(style, { pretty: true });@small: 3;
@large: 6;
#layer {
marker-width: @small;
marker-allow-overlap: true;
[zoom = 4] {
marker-width: @large;
}
}
#selector {
line-dasharray: 1, 4, 2;
marker-width: ramp([price], (10, 20, 30), jenks());
}
#world {
text-name: "[NAME]";
text-size: 11;
text-face-name: "Georgia Regular", "Arial Italic";
}
Type: Boolean
Default: false
Serialize pretty CartoCSS
yarn
yarn test
npm version patch|minor|major
npm publish
Browsers support made by godban
![]() IE / Edge |
![]() Firefox |
![]() Chrome |
![]() Safari |
|---|---|---|---|
| IE11, Edge | last 3 versions | last 3 versions | last 3 versions |




