My goal is to use Meteor and Iron-Router to serve dynamic SVG files with templating capabilities.
To start, I create a new route:
@route 'svg', {
path: '/svg/:name'
data: -> { name: this.params.name } # sample data
layoutTemplate: 'svg'
}
Next, I set up a template:
<template name="svg">
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
width="500"
height="500"
id="svg2">
<defs
id="defs4" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
transform="translate(0,-552.36218)"
id="layer1">
<text
x="55.067966"
y="838.08844"
id="text2985"
xml:space="preserve"
style="font-size:108.92150116px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Source Sans Pro;-inkscape-font-specification:Source Sans Pro"><tspan
x="55.067966"
y="838.08844"
id="tspan2987">{{name}}</tspan></text>
</g>
</svg>
</template>
When I navigate to http://localhost:3000/svg/foobar
, I encounter the following error (in the browser):
Your app is crashing. Here's the latest log.
=> Errors prevented startup:
While building the application:
client/infrastructureViews/svg.html:2: Expected tag name after `<`
<?xml version="1.0" e...
^
=> Your application has errors. Waiting for file change.
Question: How can I instruct Meteor or Iron-Router not to generate the surrounding <html>...
structure and recognize the SVG as a spacebars top-level element?