Regarding Shrink variables

34 views
Skip to first unread message

Tito George

unread,
May 29, 2012, 3:27:56 AM5/29/12
to ie7...@googlegroups.com
When i run Packer with Shrink variables on below code, only the first variable 'contentNode' got replaced. listNode and footerNode did not change.

Original
function(){   
var cNode = create('<div>'),
        lNode = create('<ul>'),
        fNode= create('<footer>');
}

Output
function(){var a=create('<div>'),listNode=create('<ul>'),footerNode=create('<footer>')}

I am new to Packer, Are there any reference document for supported coding conventions to get the best compression out.

Andrew Donelson

unread,
Feb 25, 2013, 1:50:18 PM2/25/13
to ie7...@googlegroups.com
function(){    
var cNode = create('<div>');
var lNode = create('<ul>');
var fNode = create('<footer>');
}

function(){var a=create('<div>');var b=create('<ul>');var c=create('<footer>')}

works fine, but lint will complain about combining your vars.

for a function with no parameters, i guess you could do this...

function($cNode,$lNode,$fNode){    
$cNode = create('<div>');
$lNode = create('<ul>');
$fNode = create('<footer>');
}

function(a,b,c){a=create('<div>');b=create('<ul>');c=create('<footer>')}

Now you have shrunk variables and lint is happy!
Reply all
Reply to author
Forward
0 new messages