Что такое findslide.org?

FindSlide.org - это сайт презентаций, докладов, шаблонов в формате PowerPoint.


Для правообладателей

Обратная связь

Email: Нажмите что бы посмотреть 

Яндекс.Метрика

Презентация на тему JS and CSS Bundling and Minification

R.JS (require.js)> npm install -g requirejs > r.js -o app.build.js({ baseUrl: "../../Scripts", paths: { "d3": "d3", "jquery": "jquery-2.0.3", "bootstrap": "bootstrap", "select2": "select2/select2",
Frontend Optimization. JS and CSS Bundling and Minification R.JS (require.js)> npm install -g requirejs > r.js -o app.build.js({  baseUrl: Microsoft ASP.NET Web Optimization Framework> Install-Package Microsoft.AspNet.Web.Optimization public class BundleConfig  { System.Web.Optimization var lessBundle = new Bundle( HTTP GZIP compression 1. Open IIS server by using inetmgr from windows HTTP GZIP compression  public class CompressAttribute : ActionFilterAttribute  { HTTP expire header HTTP expire header public class NoCache : ActionFilterAttribute  {
Слайды презентации

Слайд 2 R.JS (require.js)
> npm install -g requirejs
> r.js

R.JS (require.js)> npm install -g requirejs > r.js -o app.build.js({ baseUrl:

-o app.build.js

({
baseUrl: "../../Scripts",
paths: {

"d3": "d3",
"jquery": "jquery-2.0.3",
"bootstrap": "bootstrap",
"select2": "select2/select2",
},
name: "../App/EntryPoint",
exclude: ["JsAction", "signalr", "Config"],
optimize: "uglify2",
generateSourceMaps: true,
preserveLicenseComments: false,
out: "app.js"
})



Слайд 3 Microsoft ASP.NET Web Optimization Framework
> Install-Package Microsoft.AspNet.Web.Optimization

public

Microsoft ASP.NET Web Optimization Framework> Install-Package Microsoft.AspNet.Web.Optimization public class BundleConfig {

class BundleConfig
{
public static

void RegisterBundles(BundleCollection bundles)
{
ScriptBundle thirdPartyScripts = new ScriptBundle("~/Scripts/ThirdParty");
thirdPartyScripts.Include("~/Scripts/jquery-2.0.3.js",
"~/Scripts/bootstrap.min.js");
bundles.Add(thirdPartyScripts);
BundleTable.EnableOptimizations = true;
}
}

BundleConfig.RegisterBundles(BundleTable.Bundles);

@Scripts.Render("~/Scripts/ThirdParty")

Слайд 4 System.Web.Optimization
var lessBundle = new Bundle("~/st-style-common-2")
.IncludeDirectory("~/Admin/Resources/styles/", "*.less");
lessBundle.Transforms.Add(new

System.Web.Optimization var lessBundle = new Bundle(

LessTransform());
lessBundle.Transforms.Add(new CssMinify());
bundles.Add(lessBundle);

@Scripts.Render("~/st-style-common-2")


Слайд 5 HTTP GZIP compression
1. Open IIS server by using

HTTP GZIP compression 1. Open IIS server by using inetmgr from

inetmgr from windows Run command box.
2. Click on sites.

It shows you all the sites hosted on this server. If you want to to enable http compression for all sites you can configure settings by clicking on server name.
3. Select the site for which you want to configure http compression under Sites node.
4. From right pane of IIS manager click on Compression.
5. Select Enable dynamic content compression for dynamic contents.
6. Select Enable static Content compression for static contents.























Слайд 6 HTTP GZIP compression
public class CompressAttribute : ActionFilterAttribute

HTTP GZIP compression public class CompressAttribute : ActionFilterAttribute {  public

{
public override void OnActionExecuting(ActionExecutingContext

filterContext)
{
var request = filterContext.HttpContext.Request;
var response = filterContext.HttpContext.Response;

CompressResponse(request, response);
}

public static void CompressResponse(HttpRequestBase request, HttpResponseBase response)
{
var acceptEncoding = request.Headers["Accept-Encoding"];
if (string.IsNullOrEmpty(acceptEncoding)) return;
acceptEncoding = acceptEncoding.ToUpperInvariant();
if (acceptEncoding.Contains("GZIP"))
{
response.AppendHeader("Content-encoding", "gzip");
response.Filter = new GZipStream(response.Filter, CompressionMode.Compress);
}
else if (acceptEncoding.Contains("DEFLATE"))
{
response.AppendHeader("Content-encoding", "deflate");
response.Filter = new DeflateStream(response.Filter, CompressionMode.Compress);
}
}
}

Слайд 7 HTTP expire header



HTTP expire header

cacheControlCustom="public"
cacheControlMaxAge="30.00:00:00" cacheControlMode="UseMaxAge" />








  • Имя файла: js-and-css-bundling-and-minification.pptx
  • Количество просмотров: 121
  • Количество скачиваний: 0