individually minify JS and CSS in Visual Studio 2010

后端 未结 1 1189
名媛妹妹
名媛妹妹 2020-12-18 06:51

I\'m currently migrating a project to Visual Studio 2010 and am trying to figure out how to minify JS and CSS files individually on build.

In Visual

相关标签:
1条回答
  • 2020-12-18 06:56

    This should still be possible with VS2010 by editing the csproj aka msbuild file.

    Taken from this thread on CodePlex.

    <ItemGroup>
      <JavaScriptFiles Remove="@(JavaScriptFiles)" />
      <JavaScriptFiles Include="../js/2.js"/>
    </ItemGroup>
    <CompressorTask
      JavaScriptFiles="@(JavaScriptFiles)"
      ObfuscateJavaScript="True"
      PreserveAllSemicolons="False"
      DisableOptimizations="Nope"
      EncodingType="Default"
      DeleteJavaScriptFiles="false"
      LineBreakPosition="-1"
      JavaScriptOutputFile="../js/2.min.js"
      LoggingType="ALittleBit"
      ThreadCulture="en-au"
      IsEvalIgnored="false"/> 
    <ItemGroup>
      <JavaScriptFiles Remove="@(JavaScriptFiles)" />
      <JavaScriptFiles Include="../js/3.js" />
      <JavaScriptFiles Include="../js/4.js" />
    </ItemGroup>
    <CompressorTask
      CssFiles="@(CssFiles)"
      DeleteCssFiles="false"
      CssOutputFile="../css/release.css"
      CssCompressionType="YuiStockCompression"
      JavaScriptFiles="@(JavaScriptFiles)"
      ObfuscateJavaScript="True"
      PreserveAllSemicolons="False"
      DisableOptimizations="Nope"
      EncodingType="Default"
      DeleteJavaScriptFiles="false"
      LineBreakPosition="-1"
      JavaScriptOutputFile="../js/3.min.js"
      LoggingType="ALittleBit"
      ThreadCulture="en-au"
      IsEvalIgnored="false"/>
    

    0 讨论(0)
提交回复
热议问题