Skip to content
This repository was archived by the owner on Jan 5, 2026. It is now read-only.

CartoDB/CartoJSS

Repository files navigation

⚠️ ARCHIVED - This repository is no longer maintained

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


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

About

[ARCHIVED] Write CartoCSS using a Javascript object

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors