开发者

Exclude non minified java script from release build

开发者 https://www.devze.com 2023-01-28 08:55 出处:网络
I have a .NET library which provides some AJAX controls. The library is build with Visual Studio 2008. The ajax minifier task is used to auto generate minified javascript files.

I have a .NET library which provides some AJAX controls. The library is build with Visual Studio 2008. The ajax minifier task is used to auto generate minified javascript files. In a debug build I need the original javascript files for debugging the javascript, but in a release build these have no usage.

What would you recommend? Ignore them in the release and let them blow up the file size? Would there be a penality in loading time? Or would you remove them from the release build? How? I could modify the project file and add a condition attribute. But this does not well integrate in Visual Studio.

EDIT:

To clearify: T开发者_如何学JAVAhe primary question is: What are the arguments for including and excluding the non minified files.

UPDATE:

Just found a solution a nice solution for the auto exclusion. Hers a part of my project file:

<ItemGroup>
  <EmbeddedJavascript Include="MyJavascript.debug.js" />
  <EmbeddedResource Include="MyJavascript.js" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\MicrosoftAjax\ajaxmin.tasks" />
<Target Name="BeforeBuild">
  <ItemGroup Condition=" '$(Configuration)' != 'Release' ">
    <EmbeddedResource Include="@(EmbeddedJavascript)" />
  </ItemGroup>
  <AjaxMin JsSourceFiles="@(EmbeddedJavascript)" JsSourceExtensionPattern="\.debug\.js$" JsTargetExtension=".js" />
</Target>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号