YUI Compression

Mar 10, 2014 at 7:19 AM
Hi,

`There are two tasks that i do on my publish <UsingTask TaskName="CssCompressorTask" AssemblyFile="C:\Projects\netcalyx\Cygnus\Yahoo.Yui.Compressor v2.3.0.0\Yahoo.Yui.Compressor.Build.MsBuild.dll" />
<UsingTask TaskName="JavaScriptCompressorTask" AssemblyFile="C:\Projects\netcalyx\Cygnus\Yahoo.Yui.Compressor v2.3.0.0\Yahoo.Yui.Compressor.Build.MsBuild.dll" />

<PropertyGroup>
    <CssOutputFile Condition=" '$(CssOutputFile)'=='' ">SylesSheetFinal.css</CssOutputFile>
    <JavaScriptOutputFile Condition=" '$(JavaScriptOutputFile)'=='' ">$(SourceFileRootFolder)\$(WebFolder)\myjs\</JavaScriptOutputFile>
</PropertyGroup>
<Target Name="Mimify">
    <!--
        ItemGroup\CssFiles or ItemGroup\JavaScriptFiles: add zero to many files you wish to include in this compression task.
                                                         Don't forget, you can use the wildcard (eg. *.css, *.js) if you feel up to it.
                                                         Finally, at least one item is required - either a css file or a js file.

        CssFiles/JavaScriptFiles data format: Please do not touch this.
        DeleteCssFiles: [Optional] True | Yes | Yeah | Yep | True | FoSho | Fo Sho. Default is False. Anything else is False. (eg. blah = false, xxxx111 = false, etc)
        CssCompressionType: YuiStockCompression | MichaelAshsRegexEnhancements | HaveMyCakeAndEatIt or BestOfBothWorlds or Hybrid; Default is YuiStockCompression.
        ObfuscateJavaScript: [Optional] refer to DeleteCssFiles, above.
        PreserveAllSemicolons: [Optional] refer to DeleteCssFiles, above.
        DisableOptimizations: [Optional] refer to DeleteCssFiles, above.
        EncodingType: [Optional] ASCII, BigEndianUnicode, Unicode, UTF32, UTF7, UTF8, Default. Default is 'Default'.
        DeleteJavaScriptFiles: [Optional] refer to DeleteCssFiles, above.
        LineBreakPosition: [Optional] the position where a line feed is appened when the next semicolon is reached. Default is -1 (never add a line break).
                           0 (zero) means add a line break after every semicolon. (This might help with debugging troublesome files).          
        LoggingType: None | ALittleBit | HardcoreBringItOn;  Hardcore also lists javascript verbose warnings, if there are any (and there usually is :P ).
        ThreadCulture: [Optional] the culture you want the thread to run under. Default is 'en-gb'.
        IsEvalIgnored: [Optional] compress any functions that contain 'eval'. Default is False, which means a function that contains
                       'eval' will NOT be compressed. It's deemed risky to compress a function containing 'eval'. That said,
                       if the usages are deemed safe this check can be disabled by setting this value to True.
    -->
    <ItemGroup>
        <JavaScriptFiles Include="$(SourceFileRootFolder)\$(WebFolder)\Javascript\*.js" />
        <CSSFiles Include="$(SourceFileRootFolder)\$(WebFolder)\Themes\*.css" />
    </ItemGroup>
    <JavaScriptCompressorTask
      SourceFiles="@(JavaScriptFiles)"
      DeleteSourceFiles="false"
      OutputFile="@(JavaScriptFiles.FileName).min.js"
      CompressionType="Standard"
      ObfuscateJavaScript="True"
      PreserveAllSemicolons="False"
      DisableOptimizations="No"
      EncodingType="Default"
      LineBreakPosition="-1"
      LoggingType="Info"
      ThreadCulture="en-au"
      IsEvalIgnored="false"
        />
     <CssCompressorTask
    SourceFiles="@(CssFiles)"
    DeleteSourceFiles="false"
    OutputFile="%(CssFiles.FileName).min.css"
    CompressionType="Standard"
    LoggingType="Info"
    PreserveComments="false"
    LineBreakPosition="-1"
/>
</Target>`
i want to compress the css and js file separately while publishing and copy the file (with same name) to the output directory. The js files seems to be not compressing at all.

Please help to resolve this..or guide me...thanks.

Regards,
Coordinator
Mar 10, 2014 at 5:17 PM
What output do you see when you run this? Are you sure you are actually picking up any javascript files?