dust-compressor

advanced whitespace compression for dustjs

npm install dust-compressor
8 downloads in the last month

dust-compressor

Build Status NPM version

per default white spaces are compressed by stripping out linebreaks. that leads to lost linebreaks which could lead to invalid and broken inline javascript/css. also multiple spaces are inside a block are ignored.

dust-compressor provides a improved and context sensitive compressor:

installation

npm install dust-compressor

usage

var dust = require('dust-compressor').install(require('dustjs-linkedin'));

examples

(see the examples folder)

default behaviour:

datapoint.         anotherDataPoint.datapoint.         anotherDataPoint.datapoint.         anotherDataPoint.

no whitespace compression:








       datapoint.         anotherDataPoint.

       datapoint.         anotherDataPoint.

       datapoint.         anotherDataPoint.

optimized compressor (per dust-compressor):


datapoint. anotherDataPoint.
datapoint. anotherDataPoint.
datapoint. anotherDataPoint.

note

this is work in progress, so there's no guarantee it wouldn't break your code!

feel free to list edge cases!

npm loves you