如何调试包括在非捆绑和js和CS文件的版本minified的 [英] How to include non bundle and minified version of js and cs file during debugging

查看:157
本文介绍了如何调试包括在非捆绑和js和CS文件的版本minified的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要加载的非捆绑和非缩小的CSS和JS文件在我的页面时,我测试我的网站,或从VS IDE与调试模式下运行我的网站但调试后,当我将部署在IIS中的网站或运行VS IDE网站以发布模式,然后再精缩总是版本的js和css文件应该加载。只是引导我做什么或如何实现这一点。

i want to load non bundle and non minified css and js file in my page when i am testing my web site or running my web site from VS IDE with debug mode but after debug when i will deploy the web site in IIS or run the web site from VS IDE with release mode then then always minified version js and css file should load. just guide me what to do or how to achieve this.

我得到了来自网站的http://www.davepaquette.com/archive/2014/10/08/how-to-use-gulp-in-visual-studio.aspx

@if (HttpContext.Current.IsDebuggingEnabled)
{
    <!-- Bootstrapping -->
    <script src="app/app.js"></script>
    <script src="app/config.js"></script>
    <script src="app/config.exceptionHandler.js"></script>
    <script src="app/config.route.js"></script>
    <!-- app Services -->
    <script src="app/services/datacontext.js"></script>
    <script src="app/services/directives.js"></script>
}
else
{
    <script src="app/all.min.js"></script>
}

这种方式从VS IDE与调试模式下运行或测试网站中,我们可以加载JS或CSS文件的非缩小的版本。

但我相信某种功能必须在有IDE本身由它来完成工作。我与VS IDE 2013的工作。

but i believe some kind of feature must be there in IDE itself which does the job. i am working with VS IDE 2013.

code://www.asp。净/ MVC /概述/性能/捆扎-和微小

code taken from http://www.asp.net/mvc/overview/performance/bundling-and-minification

public static void RegisterBundles(BundleCollection bundles)
{
    bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                 "~/Scripts/jquery-{version}.js"));

    // Code removed for clarity.
    BundleTable.EnableOptimizations = true;
}

这行做 BundleTable.EnableOptimizations = TRUE; ?

如果有人明白我的用意什么我找的话,请指导我如何实现这一目标与VS IDE时二千○一十五分之二千○一十三

if some one understand my intention that what i am looking for then please guide me how to achieve this when working with VS IDE 2013/2015

感谢

推荐答案

使用 preprocessor指令告诉编译器preprocess complation发生之前。

Use preprocessor directives which tells compiler to preprocess before complation takes place.

BundleConfig 把这块code的

#if DEBUG
        BundleTable.EnableOptimizations = false;
 #else
        BundleTable.EnableOptimizations = true;
#endif

这篇关于如何调试包括在非捆绑和js和CS文件的版本minified的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆