minifykr
v0.0.11
Published
Concatenate and minify XML files in krpano projects
Downloads
4
Readme
minifykr.js
A script to concatenate and minify XML files in krpano projects.
No tests yet, shamefully.
##Installation
npm install [-g] minifykr
Usage
As script
minifykr [ --noEncrypt ] [ --noMinify ] [ inputFile ] [ outputFile ]
The default value for
inputFile
ismain.xml
The default value for
outputFile
isINPUT_FILE.min.xml
When
--noEncrypt
is specified, the output will be encrypted usingkencrypt
. This requireskencrypt
to be in the PATHWhen
--noMinify
is specified, the output will no be minified. It will be the result of merging all files together.
As module
var minifykr = require('minifykr');
var minifiedData = minifykr.data(inputData);
minifykr.file(inputFile, outputFile, encrypt, minify)
Features
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
Related projects
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.