{"_id":"@cartocss/carto","_rev":"2-13dead3398e03896852fbcc04ab85560","name":"@cartocss/carto","dist-tags":{"latest":"1.3.1"},"versions":{"1.3.0":{"name":"@cartocss/carto","version":"1.3.0","keywords":["mapnik","maps","css","stylesheets"],"author":{"url":"http://github.com/cartocss/","name":"CartoCSS Team"},"license":"Apache-2.0","_id":"@cartocss/carto@1.3.0","maintainers":[{"name":"nebulon42","email":"nebulon42@mailbox.org"},{"name":"gravitystorm","email":"npmjs@gravitystorm.co.uk"}],"contributors":[{"name":"Tom MacWright","email":"macwright@gmail.com"},{"name":"Konstantin Käfer"},{"name":"Alexis Sellier","email":"self@cloudhead.net"}],"homepage":"https://github.com/cartocss/carto#readme","bugs":{"url":"https://github.com/cartocss/carto/issues"},"bin":{"carto":"bin/carto"},"man":["man/carto.1"],"url":"https://github.com/cartocss/carto","dist":{"shasum":"6b0f625f3e1c471f291bd4b0cc70080d7394fbd4","tarball":"https://registry.npmjs.org/@cartocss/carto/-/carto-1.3.0.tgz","fileCount":75,"integrity":"sha512-Q03K0trLamAffiPV92z4He7q+zQXtplD7QEmB4B5l/fWuxU83Xsc86oR1g4vFdTJGJhWspyFjfkMLZM3P8JKnw==","signatures":[{"sig":"MEQCIF7rSBC5OhbWX7HXVk1QysweVZ+mW1BgshZF3drCU9k+AiAFEYAZr9OwWEx+r2yvwAAHABClFg0tU6cL4rTDJWmBSA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":925244},"main":"./lib/carto/index","engines":{"node":">=0.5.x"},"gitHead":"13a3962315b61b892f4ad64053cd3a2f67824f74","scripts":{"test":"mocha -R spec --timeout 50000 -i -f jslint","pretest":"npm install && mocha -R spec --timeout 50000 -f jslint","coverage":"istanbul cover ./node_modules/.bin/_mocha -- -R spec --timeout 50000 -i -f jslint && coveralls < ./coverage/lcov.info"},"_npmUser":{"name":"gravitystorm","email":"npmjs@gravitystorm.co.uk"},"repository":{"url":"git+ssh://git@github.com/cartocss/carto.git","type":"git"},"_npmVersion":"10.8.2","description":"Mapnik Stylesheet Compiler","directories":{},"_nodeVersion":"20.19.5","dependencies":{"hsluv":"~0.0.1","yargs":"~12.0.1","lodash":"~4.17.10","semver":"~5.6.0","js-yaml":"~3.12.0","chroma-js":"~1.3.5","mapnik-reference":"~8.10.0"},"_hasShrinkwrap":false,"devDependencies":{"sax":"~1.2.1","mocha":"~5.2.0","istanbul":"~0.4.5","coveralls":"~3.0.0","mocha-eslint":"^4.0.0"},"_npmOperationalInternal":{"tmp":"tmp/carto_1.3.0_1758103924278_0.12625054000642377","host":"s3://npm-registry-packages-npm-production"}},"1.3.1":{"name":"@cartocss/carto","version":"1.3.1","description":"Mapnik Stylesheet Compiler","url":"https://github.com/cartocss/carto","repository":{"type":"git","url":"git+ssh://git@github.com/cartocss/carto.git"},"author":{"name":"CartoCSS Team","url":"http://github.com/cartocss/"},"keywords":["mapnik","maps","css","stylesheets"],"contributors":[{"name":"Tom MacWright","email":"macwright@gmail.com"},{"name":"Konstantin Käfer"},{"name":"Alexis Sellier","email":"self@cloudhead.net"}],"license":"Apache-2.0","bin":{"carto":"bin/carto"},"man":["man/carto.1"],"main":"./lib/carto/index","engines":{"node":">=8.0.0"},"dependencies":{"chroma-js":"~1.3.5","hsluv":"~0.0.1","js-yaml":"~3.14.0","lodash":"~4.17.10","mapnik-reference":"~8.10.0","semver":"~5.6.0","yargs":"~15.4.1"},"devDependencies":{"coveralls":"~3.0.0","istanbul":"~0.4.5","mocha":"~7.2.0","mocha-eslint":"^4.0.0","sax":"~1.2.1"},"scripts":{"pretest":"npm install && mocha -R spec --timeout 50000 -f jslint","test":"mocha -R spec --timeout 50000 -i -f jslint","coverage":"istanbul cover ./node_modules/.bin/_mocha -- -R spec --timeout 50000 -i -f jslint && coveralls < ./coverage/lcov.info"},"_id":"@cartocss/carto@1.3.1","gitHead":"5ccc8c1e0075896cea27febd29c689c682785b4c","bugs":{"url":"https://github.com/cartocss/carto/issues"},"homepage":"https://github.com/cartocss/carto#readme","_nodeVersion":"20.19.5","_npmVersion":"10.8.2","dist":{"integrity":"sha512-Dy2rIzGqTSodPIxKy09ePumnrleUDb9dFwL8ntKXBjACzq2DoP/l6J1Rq0WRXn9UPyw8hkcY7SXDxCYoFnhLTg==","shasum":"dd48ab1be675c2261af9d36689eb71815714275e","tarball":"https://registry.npmjs.org/@cartocss/carto/-/carto-1.3.1.tgz","fileCount":77,"unpackedSize":927398,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDxk9UYrt/hEK0Mo4mXuM+jWLvUqWqrUOTazKWlAp06EQIgcts9fxfcesas5kOUl3B29PCntAAWXV/4IC9dtxmZ1zQ="}]},"_npmUser":{"name":"gravitystorm","email":"npmjs@gravitystorm.co.uk"},"directories":{},"maintainers":[{"name":"nebulon42","email":"nebulon42@mailbox.org"},{"name":"gravitystorm","email":"npmjs@gravitystorm.co.uk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/carto_1.3.1_1758104898313_0.7304294743207984"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-17T10:12:04.141Z","modified":"2025-09-17T10:28:18.781Z","1.3.0":"2025-09-17T10:12:04.513Z","1.3.1":"2025-09-17T10:28:18.534Z"},"bugs":{"url":"https://github.com/cartocss/carto/issues"},"author":{"name":"CartoCSS Team","url":"http://github.com/cartocss/"},"license":"Apache-2.0","homepage":"https://github.com/cartocss/carto#readme","keywords":["mapnik","maps","css","stylesheets"],"repository":{"type":"git","url":"git+ssh://git@github.com/cartocss/carto.git"},"description":"Mapnik Stylesheet Compiler","contributors":[{"name":"Tom MacWright","email":"macwright@gmail.com"},{"name":"Konstantin Käfer"},{"name":"Alexis Sellier","email":"self@cloudhead.net"}],"maintainers":[{"name":"nebulon42","email":"nebulon42@mailbox.org"},{"name":"gravitystorm","email":"npmjs@gravitystorm.co.uk"}],"readme":"# CartoCSS\n\n[![Build Status](https://secure.travis-ci.org/mapbox/carto.svg)](http://travis-ci.org/mapbox/carto) [![Build status](https://ci.appveyor.com/api/projects/status/github/mapbox/carto?svg=true)](https://ci.appveyor.com/project/Mapbox/carto) [![Coverage Status](https://coveralls.io/repos/github/mapbox/carto/badge.svg?branch=master)](https://coveralls.io/github/mapbox/carto?branch=master) [![Package Version](https://img.shields.io/npm/v/carto.svg)](https://www.npmjs.com/package/carto) [![Dependencies](https://david-dm.org/mapbox/carto.svg)](https://david-dm.org/mapbox/carto)    [![Documentation Status](https://readthedocs.org/projects/cartocss/badge/?version=latest)](http://cartocss.readthedocs.io/en/latest/?badge=latest)\n\nCartoCSS (short: Carto) is a language for map design. It is similar in syntax to CSS, but builds upon it with specific abilities to filter map data and by providing things like variables.\nIt targets the [Mapnik renderer](http://mapnik.org) and is able to generate Mapnik XML and a JSON variant of Mapnik XML.\nIt can run from the command line or in the browser.\n\nCarto is an evolution of the [Cascadenik](https://github.com/mapnik/Cascadenik) idea and language, with an emphasis on speed and flexibility.\n\n## Documentation\n\nThe best place to start is to review the [CartoCSS documentation](https://cartocss.readthedocs.io).\n\nTutorials like the [Mapbox Getting started with CartoCSS guide](https://github.com/mapbox/mapbox-studio-classic/blob/mb-pages/docs/studio-classic-manual/04-classic-manual-cartocss.md) are a great place to start to learn the basics of CartoCSS.\n\nFor more advanced topics see the [Studio style quickstart guide](https://github.com/mapbox/mapbox-studio-classic/blob/mb-pages/docs/tutorials/style-quickstart.md) and [Studio style manual](https://github.com/mapbox/mapbox-studio-classic/blob/mb-pages/docs/studio-classic-manual/01-classic-manual-intro.md). The links below reference the Tilemill application, which preceded Mapbox Studio Classic, but still contain useful and relevant information.\n\n - [Details on Filtering data with CartoCSS](https://tilemill-project.github.io/tilemill/docs/guides/selectors/)\n - [How order works in rendering](https://tilemill-project.github.io/tilemill/docs/guides/symbol-drawing-order/)\n - [How to style labels](https://tilemill-project.github.io/tilemill/docs/guides/styling-labels/)\n - [How to style lines](https://tilemill-project.github.io/tilemill/docs/guides/styling-lines/)\n - [How to style polygons](https://tilemill-project.github.io/tilemill/docs/guides/styling-polygons/)\n - See also the [Styling Concepts](#styling-concepts) for explanations of advanced features.\n\n## Installation\n\nIf you are using a map design application like Kosmtik, Mapbox Studio Classic or Tilemill you already have CartoCSS installed\nand might be more interested in the language reference.\n\nElse you can install the `carto` binary with NPM by running:\n\n    npm install -g carto\n\nYou should consider using a Node.js version manager like [NVM](https://github.com/creationix/nvm).\nOptionally you may also want to install millstone which is required for resolving data in the same way as Mapbox Studio Classic does:\n\n    npm install -g millstone\n\n\nHaving `millstone` installed specifically enable support for localizing external resources (URLs and local files) referenced in your mml file, and detecting projections (using [node-srs](https://github.com/mapbox/node-srs))\n\n## Usage\n\nNow that Carto is installed you should have a `carto` command line tool available that can be run on a CartoCSS project:\n\n    carto project.mml > mapnik.xml\n\nAvailable parameters:\n* -a / --api VERSION - Specify Mapnik API version (e.g. --api 3.0.10) (default: latest Mapnik API version)\n* -b / --benchmark - Outputs total compile time\n* -f / --file - Outputs to the specified file instead of stdout\n* -h / --help - Display help message\n* -l / --localize - Use millstone to localize resources when loading an MML (default: off)\n* -n / --nosymlink - Use absolute paths instead of symlinking files\n* -o / --output - Specify output format, possible values are `mapnik` and `json` (default: `mapnik`)\n* -ppi RESOLUTION - Pixels per inch used to convert m, mm, cm, in, pt, pc to pixels (default: 90.714)\n* -q / --quiet - Do not output any warnings (default: off)\n* -v / --version - Display version information\n\nAlternatively, Carto can be used from JavaScript.\nThe `Renderer` interface is the main API for developers, and it takes an MML file as a string as input.\n\n```javascript\n// defined variables:\n// - input (the name or identifier of the file being parsed)\nvar carto = require('carto');\n\ntry {\n    var data = fs.readFileSync(input, 'utf-8');\n    var mml = new carto.MML({});\n    mml.load(path.dirname(input), data, function (err, data) {\n        var output = {};\n\n        if (!err) {\n            output = new carto.Renderer({\n                filename: input\n            }).render(data);\n        }\n\n        if (output.msg) {\n            output.msg.forEach(function (v) {\n                if (v.type === 'error') {\n                    console.error(carto.Util.getMessageToPrint(v));\n                }\n                else if (v.type === 'warning') {\n                    console.warn(carto.Util.getMessageToPrint(v));\n                }\n            });\n        }\n\n        // output content (if no errors)\n        if (output.data) {\n            console.log(output.data);\n        }\n    });\n} catch (err) {\n    // program failures\n    ...\n}\n```\n\nIf you want to use CartoCSS within the browser you should not use MML loading via `carto.MML.load`.\nInstead you should supply the JSON of the MML including the Stylesheet strings directly to `carto.Renderer.render`.\n\n## Vim\n\nTo install, download or clone this repository, then copy the `vim-carto`\ndirectory located at `build/vim-carto` to your `~/.vim` directory.\n\n    cp build/vim-carto/* ~/.vim -R\n\n## Credits\n\nCartoCSS is based on [less.js](https://github.com/cloudhead/less.js), a CSS compiler written by Alexis Sellier.\n\nSee also a [list of dependencies](https://david-dm.org/mapbox/carto#info=dependencies&view=list).\n\n## Similar projects\n\n* [Magnacarto](https://github.com/omniscale/magnacarto) (Go implementation of CartoCSS for Mapnik and Mapserver)\n\n## Authors\n\n* Tom MacWright (tmcw)\n* Konstantin Käfer (kkaefer)\n* AJ Ashton (ajashton)\n* Dane Springmeyer (springmeyer)\n* Michael Glanznig (nebulon42)\n","readmeFilename":"README.md"}