简体   繁体   中英

EnableOptimizations = true not minifying js only bundling

to bundle and minify js code i have added following code

public static void RegisterBundles(BundleCollection bundles)
        {
            BundleTable.EnableOptimizations =true;
            bundles.Add(new ScriptBundle("~/bundles/app")
                 .Include("~/app/app.js")
                 .IncludeDirectory("~/app/Auth/", "*.js", searchSubdirectories: true)
                 .IncludeDirectory("~/app/Common/", "*.js", searchSubdirectories: true)
                   );

    }

and i have <compilation debug="true" targetFramework="4.5"/> in by web config.

But its only bundling the files not minifying..

can anyone tell where am wrong...?

要启用捆绑和最小化,应将web.config中的调试密钥设置为false值:

<compilation debug="false" targetFramework="4.5"/>

The bundle doesn't work in the debug mode. Thus, we set the debug value false in web.config file, as shown in the snippet, given below:

<system.web>  
   <compilation debug="false" targetFramework="4.5.1" />  
</system.web> 

for more information https://www.c-sharpcorner.com/article/asp-net-mvc-performance-bundling-and-minification/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM