bundle绑定资源表

1.注册绑定资源表

在application_Start函数中:

(注意不要加拓展名,否则压缩时出问题)

BundleTable.Bundles.Add(new ScriptBundle("/Assets/Script").Include(

  //不要使用min文件,bundle本身就是做压缩的

  "~/Assets/js/index.js",

  "~/Assets/jQuery/jquery-{version}.js",

  "~/Assets/bootstrap/bootstrap-{version}.js",

));

BundleTable.Bundles.Add(new StyleBundle("/Assets/styles").Include(

  "~/Assets/bootstrap/bootstrap*"  //自动忽略min文件

));

2.使用绑定表

在cshtml中

@Styles.Render("~/Assets/Script.js")

3.如果不是debug模式,就会自动压缩

4.解决动态请求.css文件的方法

在windows/

 

posted @ 2017-12-04 13:55  fight139  阅读(218)  评论(0编辑  收藏  举报