Several output js file

Feb 16, 2012 at 2:26 PM

Is it possible to describe xml compessor file in order to output several minimized js files?

 

<JavaScriptFiles Include="$(SourceLocation)..\Scripts\jquery-1.6.2.min.js"/>

<JavaScriptFiles Include="$(SourceLocation)..\Scripts\MicrosoftAjax.js"/>

will be 1.min.js

 

<JavaScriptFiles Include="$(SourceLocation)..\Scripts\jquery.validate.unobtrusive.js"/>

<JavaScriptFiles Include="$(SourceLocation)..\Scripts\jquery.unobtrusive-ajax.min.js"/>

will be 2.min.js

????

Coordinator
Feb 16, 2012 at 2:40 PM
Edited Feb 16, 2012 at 2:40 PM

Hi,

Not *entirely* getting what you're saying, but I'll give it a shot:

The list of files you supply to the compressor task will result in a single output file.

If you want, say, one output file per input file, you would have to create separate tasks, one per file, so instead of:

<ItemGroup>
     <JavaScriptFiles Include=$(SourceLocation)"foo.js"/>    
     <JavaScriptFiles Include=$(SourceLocation)"bar.js"/>    
</ItemGroup>

<CompressorTask
    JavaScriptFiles="@(JavaScriptFiles)"
    JavaScriptOutputFile="foobar.min.js"
....
/>

you would do this:

<ItemGroup>
     <FooJavaScriptFiles Include=$(SourceLocation)"foo.js"/>    
     <BarJavaScriptFiles Include=$(SourceLocation)"bar.js"/>    
</ItemGroup>

<CompressorTask
    JavaScriptFiles="@(FooJavaScriptFiles)"
    JavaScriptOutputFile="foo.min.js"
....
/>

<CompressorTask
    JavaScriptFiles="@(BarJavaScriptFiles)"
    JavaScriptOutputFile="bar.min.js"
....
/>
Feb 16, 2012 at 3:17 PM

Many thanks. It's exactly what I asked you about.