diff --git a/lib/carto/renderer_js.js b/lib/carto/renderer_js.js index 57adb8d..ae840c4 100644 --- a/lib/carto/renderer_js.js +++ b/lib/carto/renderer_js.js @@ -279,14 +279,14 @@ CartoCSS.prototype = { carto.RendererJS = function (options) { this.options = options || {}; - var reference = this.options.reference || require('./torque-reference').version.latest; - tree.Reference.setData(reference); this.options.mapnik_version = this.options.mapnik_version || 'latest'; + this.reference = this.options.reference || require('./torque-reference').version.latest; this.options.strict = this.options.hasOwnProperty('strict') ? this.options.strict : false; }; // Prepare a javascript object which contains the layers carto.RendererJS.prototype.render = function render(cartocss, callback) { + tree.Reference.setData(this.reference); return new CartoCSS(cartocss, this.options); }