Error while compressing the decimal value (val: 0.6 => val:0,6)

Feb 13, 2012 at 1:40 PM

I have an object:

 

defaults = {  
    html: "",  
    opacity: 0.6,  
    loadOnDemand: true,  
    showEffect: "fade",  
    hideEffect: "fade"
};

 

 

Note the value 0.6

Result after compression:

 

defaults = {
	html : "",
	opacity : 0,
	6,
	loadOnDemand : true,
	showEffect : "fade",
	hideEffect : "fade"
};

 

I am using the task (MSBuild) for Visual Studio to compress my JS.
The following XML code:

 

<CompressorTask
	CssFiles="@(CssFiles)"
	CssOutputFile="$(cssFile)"
	CssCompressionType="YuiStockCompression"
	PreserveCssComments="false"
	JavaScriptFiles="@(JavaScriptFiles)"
	ObfuscateJavaScript="false"
	PreserveAllSemicolons="true"
	DisableOptimizations="Nope"
	JavaScriptOutputFile="$(jsFile)"
	LoggingType="ALittleBit"
	IsEvalIgnored="false" />

 

Full code in: https://gist.github.com/1817326

looking for an answer, found this thread: http://yuicompressor.codeplex.com/discussions/243522

But did not help me much


Coordinator
Feb 14, 2012 at 8:18 AM

Hello,

Try supplying "iv" as the thread culture to force the task to use the invariant culture:

<CompressorTask
	CssFiles="@(CssFiles)"
	CssOutputFile="$(cssFile)"
	CssCompressionType="YuiStockCompression"
	PreserveCssComments="false"
	JavaScriptFiles="@(JavaScriptFiles)"
	ObfuscateJavaScript="false"
	PreserveAllSemicolons="true"
	DisableOptimizations="Nope"
	JavaScriptOutputFile="$(jsFile)"
	LoggingType="ALittleBit"
	IsEvalIgnored="false" 
	ThreadCulture="iv" />


Feb 23, 2012 at 8:39 AM

I'm using up to date version 1.7.0.0 but still have some issues. I have set

ThreadCulture="iv"

in my MSBuildSetting.xml but t did not help for me.

Starting Css/Javascript compression...
Using version 1.7.0.0 of YUI Compressor .NET Library MsBuild Task.
Current thread culture / UI culture (before modifying, if requested): Polish (Poland)/Polish (Poland)

...

# Found one or more JavaScript file arguments. Now parsing ...
** Obfuscate Javascript: Yep!
** Preserve semi colons: Nope :(
** Disable optimizations: Yeah :(
** Line break position: 0
** Thread Culture: Invariant Language (Invariant Country)

But my objects that contain numbers like 0.6 are translated to 0,6 that breaks initialization.

 

Coordinator
Feb 23, 2012 at 9:56 AM

Hi,

There is a bug in that version, which was fixed about 2 days later - grab changeset 75096 and build YUICompressor from that source code and you shouldn't need to specify a culture as it will default to invariant unless a culture is supplied