asp.net web api——BundleConfig类的使用
2021-06-11 21:06
YPE html>
标签:dev site color you public java nts 选择 ons
BundleConfig设置好,然后在页面就能引用
public class BundleConfig
{
// 有关捆绑的详细信息,请访问 https://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
// 使用要用于开发和学习的 Modernizr 的开发版本。然后,当你做好
// 生产准备就绪,请使用 https://modernizr.com 上的生成工具仅选择所需的测试。
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js"));
bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/bootstrap.css", "~/Content/site.css"));
}
}
接下来开始引用:
@Styles.Render("~/Content/css")
@Scripts.Render("~/bundles/modernizr")
@RenderBody()
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/bootstrap")
@RenderSection("scripts", required: false)
如果布局页面有定义节点 @RenderSection("ScriptSection", required: false) ,那么在子页面中可以使用 @section ScriptSection{} 来引用js或者css。这个作用相当于在布局页中定义了一个占位,在子页面中去填充这个占位
显示结果
http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
charset="utf-8" /> | |
name="viewport" content="width=device-width" /> | |
href="http://www.soscw.com//Content/bootstrap.css" rel="stylesheet"/> | |
href="http://www.soscw.com//Content/site.css" rel="stylesheet"/> | |
http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
class="navbar navbar-inverse navbar-fixed-top">
|
|
class="container">
|
|
class="navbar-header">
|
|
class="icon-bar"> | |
class="icon-bar"> | |
class="icon-bar"> | |
class="navbar-brand" href="http://www.soscw.com//">应用程序名称 | |
class="navbar-collapse collapse">
|
|
|
|
class="container body-content">
|
|
class="jumbotron">
|
|
ASP.NET |
|
class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS, and JavaScript. |
|
href="http://www.soscw.com/https://asp.net" class="btn btn-primary btn-lg">Learn more » |
|
class="row">
|
|
class="col-md-4">
|
|
Getting started |
|
ASP.NET Web API is a framework that makes it easy to build HTTP services that reach |
|
a broad range of clients, including browsers and mobile devices. ASP.NET Web API | |
is an ideal platform for building RESTful applications on the .NET Framework. | |
class="col-md-4">
|
|
Get more libraries |
|
NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects. |
|
class="col-md-4">
|
|
Web Hosting |
|
You can easily find a web hosting company that offers the right mix of features and price for your applications. |
|
© 2019 - 我的 ASP.NET 应用程序 |
|
asp.net web api——BundleConfig类的使用
标签:dev site color you public java nts 选择 ons
原文地址:https://www.cnblogs.com/zhaoxiansheng/p/10545726.html
文章标题:asp.net web api——BundleConfig类的使用
文章链接:http://soscw.com/index.php/essay/93713.html