Info
Version: | 1.0.3.1 |
Author(s): | 王建川 |
Last Update: | Tuesday, November 19, 2013 |
.NET Fiddle: | Create the first Fiddle |
NuGet Url: | https://www.nuget.org/packages/ExfSoft.Web.Optimization |
Install
Install-Package ExfSoft.Web.Optimization
dotnet add package ExfSoft.Web.Optimization
paket add ExfSoft.Web.Optimization
ExfSoft.Web.Optimization Download (Unzip the "nupkg" after downloading)
Dependencies
- Microsoft.Web.Infrastructure(1.0.0.0)
- WebGrease(1.5.2)
Tags
使用方法:Web.config中:<add namespace="ExfSoft.Web.Optimization"/>;
网页中:
@Scripts.Render("~/packages/jquery")
@Scripts.Build("~/Scripts/abc-{version}.js")
@Scripts.Build("~/Scripts/test1.js", new { attr = "value" })
@Styles.Build("~/Content/site.css")
在使用@Scripts.Render时需要
第一步:在Global.asax代码里
protected void Application_Start()
{
BundleConfig.RegisterBundles(BundleTable.Bundles); //增加
}
第二步:在App_Start里增加一个文件BundleConfig.cs
public class BundleConfig
{
internal static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/packages/jquery").Include(
"~/Scripts/jQuery.{version}.js"));
}
}.