cartojss
v0.2.1
Published
Serializer of CartoCSS javascript objects
Downloads
27
Maintainers
Keywords
Readme
CartoJSS
Generate CartoCSS and Turbocarto ramps from a JavaScript object
Install
$ npm install cartojss
Usage
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";
}
Options
pretty
Type: Boolean
Default: false
Serialize pretty CartoCSS
Development
yarn
yarn test
Publish
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