cartojss

0.2.1 • Public • Published

CartoJSS

Build Status js-semistandard-style

NPM

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
IE / Edge
Firefox
Firefox
Chrome
Chrome
Safari
Safari
IE11, Edge last 3 versions last 3 versions last 3 versions

Readme

Keywords

none

Package Sidebar

Install

npm i cartojss

Weekly Downloads

16

Version

0.2.1

License

BSD-3-Clause

Last publish

Collaborators

  • aalmonacid
  • donmccurdy
  • moicalcob
  • m.deividas
  • vmilan
  • felixpalmer
  • josmorsot
  • aaranadev
  • zbigg
  • eamadorp
  • juanra-carto
  • cartodb
  • victor.velarde
  • shylpx
  • jaragon
  • jesus-arroyo