Quantcast
Channel: Hacker News
Viewing all articles
Browse latest Browse all 737

Nginx module by Google for rewriting web pages to reduce latency and bandwidth

$
0
0


Nginx module created by Google to help Make the Web Faster by rewriting web pages to reduce latency and bandwidth. It started as a port of mod_pagespeed to Nginx, and for now the documentation links below still all point to mod_pagespeed's documentation.

Here are some of the most useful PageSpeed filters. Each one has a simple HTML example attached; click "before" to see the original file, and "after" to see what PageSpeed produces with that filter (and only that filter) enabled. The two versions should look exactly the same, but the "after" one will be (slightly) speedier. Use "view source" to see the PageSpeed difference!

add_instrumentationAdds client-side latency instrumentation.beforeaftercanonicalize_javascript_librariesRecognizes common JavaScript libraries and redirects each to a canonical URL.beforeaftercollapse_whitespaceRemoves unnecessary whitespace in HTML.beforeaftercombine_cssCombines multiple CSS files into one.beforeaftercombine_headsCombines multiple <head> elements into one.beforeaftercombine_javascriptCombines multiple JavaScript files into one.beforeafterdefer_javascriptDefers the execution of javascript in the HTML.beforeafterelide_attributesRemoves unnecessary attributes in HTML tags.beforeafterpedanticAdds default type attributes to script and style tags that are missing them.beforeafterextend_cacheImproves cacheability.beforeafterextend_cache_pdfsImproves cacheability of PDFs.beforeafterfallback_rewrite_css_urlsRewrite URLs in CSS even if CSS is not parseable.beforeafterflatten_css_importsFlattens @import rules in CSS by replacing the rule with the contents of the imported resource.beforeafterinline_cssInlines small external CSS files.beforeafterinline_import_to_linkInlines style tags comprising only CSS @imports by converting them to an equivalent link.beforeafterinline_javascriptInlines small external Javascript files.beforeafterinline_preview_imagesDelays original images; serves inlined, low-quality placeholder images until originals are loaded.beforeafterinsert_dns_prefetchInjects <link rel="dns-prefetch" href="http://redirect.viglink.com?key=11fe087258b6fc0532a5ccfc924805c0&u=%2F%2Fwww.example.com"> tags in the HEAD to enable the browser to do DNS prefetching.beforeafterinsert_gaInserts Google Analytics javascript snippet.beforeafterlazyload_imagesLoads images when they become visible in the client viewport.beforeafterlocal_storage_cacheLoads inlined CSS and image resources into HTML5 local storage whence the client fetches them subsequently rather than the server sending them again.beforeaftermake_google_analytics_asyncConverts synchronous Google Analytics code to load asynchronously.beforeaftermove_css_above_scriptsMoves CSS Above Scripts.beforeaftermove_css_to_headMoves CSS into the <head> element.beforeafteroutline_cssMoves large inline <style> tags into external files for cacheability.beforeafteroutline_javascriptMoves large inline <script> tags into external files for cacheability.beforeafterprioritize_critical_cssInstruments the page, inlines its critical CSS at the top, and lazily loads the rest.beforeafterMapProxyDomainProxies/optimizes trusted resources from domains not running PageSpeed.beforeafterremove_commentsRemoves HTML comments.beforeafterremove_quotesRemoves unnecessary quotes in HTML tags.beforeafterresize_mobile_imagesJust like inline_preview_images, but uses smaller placeholder images for mobile browsers.beforeafterrewrite_cssMinifies CSS.beforeafterrewrite_css + extend_cacheCache extends images in CSS.beforeafterrewrite_css + rewrite_imagesRe-compress images in CSS.beforeafterrewrite_imagesRescales, and compresses images; inlines small ones.beforeafterrewrite_javascriptMinifies Javascript.beforeafterrewrite_style_attributesRewrite the CSS in style attributes by applying the configured rewrite_css filter to it.beforeafterrewrite_style_attributes_with_urlRewrite the CSS in style attributes by applying the configured rewrite_css filter to it, but only if the attribute contains the text 'url('.beforeaftersprite_imagesSprites images.beforeaftertrim_urlsRemoves unnecessary prefixes from URLs.beforeafter

Viewing all articles
Browse latest Browse all 737

Trending Articles