0.2.1 • Published 7 years ago

cartojss v0.2.1

Weekly downloads
3
License
BSD-3-Clause
Repository
github
Last release
7 years ago

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 / EdgeFirefoxChromeSafari
IE11, Edgelast 3 versionslast 3 versionslast 3 versions