Comparing version 1.0.0 to 1.0.1
# Changelog | ||
## 1.0.1 | ||
* Fix a error in the serialization process. ([#473](https://github.com/mapbox/carto/issues/488)) | ||
## 1.0.0 | ||
@@ -4,0 +8,0 @@ |
@@ -171,3 +171,3 @@ var _ = require('lodash'); | ||
} | ||
else { | ||
else if (!_.isNil(json)) { | ||
return json.toString(); | ||
@@ -174,0 +174,0 @@ } |
{ | ||
"name": "carto", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Mapnik Stylesheet Compiler", | ||
@@ -5,0 +5,0 @@ "url": "https://github.com/mapbox/carto", |
@@ -64,38 +64,40 @@ # CartoCSS | ||
// defined variables: | ||
// - input (the name or identifier of the file being parsed) | ||
var carto = require('carto'); | ||
```javascript | ||
// defined variables: | ||
// - input (the name or identifier of the file being parsed) | ||
var carto = require('carto'); | ||
try { | ||
var data = fs.readFileSync(input, 'utf-8'); | ||
var mml = new carto.MML({}); | ||
mml.load(path.dirname(input), data, function (err, data) { | ||
var output = {}; | ||
try { | ||
var data = fs.readFileSync(input, 'utf-8'); | ||
var mml = new carto.MML({}); | ||
mml.load(path.dirname(input), data, function (err, data) { | ||
var output = {}; | ||
if (!err) { | ||
output = new carto.Renderer({ | ||
filename: input | ||
}).render(data); | ||
} | ||
if (!err) { | ||
output = new carto.Renderer({ | ||
filename: input | ||
}).render(data); | ||
} | ||
if (output.msg) { | ||
output.msg.forEach(function (v) { | ||
if (v.type === 'error') { | ||
console.error(carto.Util.getMessageToPrint(v)); | ||
} | ||
else if (v.type === 'warning') { | ||
console.warn(carto.Util.getMessageToPrint(v)); | ||
} | ||
}); | ||
} | ||
if (output.msg) { | ||
output.msg.forEach(function (v) { | ||
if (v.type === 'error') { | ||
console.error(carto.Util.getMessageToPrint(v)); | ||
} | ||
else if (v.type === 'warning') { | ||
console.warn(carto.Util.getMessageToPrint(v)); | ||
} | ||
}); | ||
} | ||
// output content (if no errors) | ||
if (output.data) { | ||
console.log(output.data); | ||
} | ||
}); | ||
} catch (err) { | ||
// program failures | ||
... | ||
} | ||
// output content (if no errors) | ||
if (output.data) { | ||
console.log(output.data); | ||
} | ||
}); | ||
} catch (err) { | ||
// program failures | ||
... | ||
} | ||
``` | ||
@@ -102,0 +104,0 @@ If you want to use CartoCSS within the browser you should not use MML loading via `carto.MML.load`. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15456920
130