Concatenate and minify XML files in krpano projects


A script to concatenate and minify XML files in krpano projects.

No tests yet, shamefully.


npm install [-g] minifykr

minifykr [ --noEncrypt ] [ --noMinify ] [ inputFile ] [ outputFile ]

  • The default value for inputFile is main.xml

  • The default value for outputFile is INPUT_FILE.min.xml

  • When --noEncrypt is specified, the output will be encrypted using kencrypt. This requires kencrypt to be in the PATH

  • When --noMinify is specified, the output will no be minified. It will be the result of merging all files together.

var minifykr = require('minifykr');

var minifiedData =;

minifykr.file(inputFile, outputFile, encrypt, minify)

krpano projects often consist of a large number of XML files, which have to be loaded by the browser. This script minifies the XML code, merging all the files and removing unnecessary code, such as comments or spaces between XML tags.

This script recursively transverses all the files which are included in inputFile through <include> tags, minifies their code and writes the result to outputFile. Minifying does the following:

  • removes comments

  • removes characters between tags

  • removes text inside tags which are not <data> or <action>

##Known issues/missing features

  • <include> tags inside other tags are not parsed

This script uses a modified version of node-elementtree to parse and generate XML. The modification removes the automatic attribute ordering, to keep the order of the url and alturl attributes.

There's also a python implementation, which does not keep the attribute order.