GithubHelp home page GithubHelp logo

cdl0266 / minifykr.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from digisfera/minifykr.js

0.0 1.0 0.0 370 KB

A script to concatenate and minify XML files in krpano projects

JavaScript 87.98% Makefile 1.07% CoffeeScript 10.95%

minifykr.js's Introduction

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 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.

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.

minifykr.js's People

Contributors

manuelcabral avatar emanuelbsilva avatar tjgq avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.