1 Minification JavaScript & CSS. 2 Minification Removing 0 Whitespace 0 Line Breaks 0 Comments 0 Shrink Variables 0 Optimize Code.

Slides:



Advertisements
Similar presentations
Optimizing Websites with YSlow Tom Lianza Co-Founder Wishlisting.com Tom Lianza Co-Founder Wishlisting.com.
Advertisements

17 HTML, Scripting, and Interactivity Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and.
CS193H: High Performance Web Sites Lecture 13: Rule 10 – Minify JavaScript Steve Souders Google
Introducing JavaScript
Javascript Code Quality Check Tools Javascript Code Quality Check Tools JavaScript was originally intended to do small tasks in webpages, but now JavaScript.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Tutorial 10 Programming with JavaScript
High Performance Websites (Based on Steve Souder’s lecture) By Bhoomi Patel.
 What I hate about you things people often do that hurt their Web site’s chances with search engines.
Performance, SEO, Accessibility Ivan Zhekov Telerik Corporation
Philly.NET Hands-on Labs JAVASCRIPT SERIES. July 9: JavaScript Syntax Visual Studio ◦Projects ◦Editors ◦Debugging ◦Script blocks ◦Minification and bundling.
Keeping Front End Dependencies Under Control Rachel Lehman Technical Team at Interfolio, -
Programming with JavaScript (Chapter 10). XP Various things Midterm grades: Friday Winter Career Fair – Thursday, April 28, 2011 (11 am to 3 pm). – MAC.
Chapter 19: Adding JavaScript
The Evils of Copy and Paste Presented by Daniel Daugherty
1 JavaScript in Context. Server-Side Programming.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 2: What is JavaScript?
Tutorial 10 Programming with JavaScript. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
Tutorial 10 Programming with JavaScript
Done by: Hanadi Muhsen1 Tutorial 1.  Learn the history of JavaScript  Create a script element  Write text to a Web page with JavaScript  Understand.
Web Performance Optimization Boban Stojanovski (Senior Front End Developer at Solaborate) Think Fast by default.
Board Activity Find your seat on the seating chart Login – Remember your login is your first initial your last name and the last three numbers of your.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
FireBug. What is Firebug?  Firebug is a powerful tool that allows you to edit HTML, CSS and view the coding behind any website: CSS, HTML, DOM and JavaScript.
Using Microsoft Visual Studio C++ Express 2005 Name: Dr Ju Wang Ashwin Belle Course Resource:
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
JavaScript Syntax, how to use it in a HTML document
Crazy New CSS Tools MIS 424 MIS 424 Professor Sandvig Professor Sandvig.
GeoGebra on mobile devices GeoGebraMobile, the JavaScript version of GeoGebra. Gabor Ancsin (this man =>)
PERFORMANCE ENHANCEMENT IN ASP.NET By Hassan Tariq Session #1.
Development Web With IntelliJ IDEA 雷卷. 2 Agenda Editor Actions JavaScript support HTML Support CSS support Code Inspection Intention.
Compiler Construction Dr. Naveed Ejaz Lecture 4. 2 The Back End Register Allocation:  Have each value in a register when it is used. Instruction selection.
1 Server versus Client-Side Programming Server-SideClient-Side.
1 JavaScript in Context. Server-Side Programming.
Restricted © Siemens AG All rights reserved A Developer’s Insights Into Performance Optimizations for Mobile Web Apps CT DC AA EM LP2 | June 2015.
Functions Math library functions Function definition Function invocation Argument passing Scope of an variable Programming 1 DCT 1033.
Introduction to JavaScript CSc 2320 Fall 2014 Disclaimer: All words, pictures are adopted from “Simple JavaScript”by Kevin Yank and Cameron Adams and also.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Understanding JavaScript and Coding Essentials Lesson 8.
Bundles, Minification Andres Käver, IT Kolledž
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Introduction to JavaScript MIS 3502, Spring 2016 Jeremy Shafer Department of MIS Fox School of Business Temple University 2/2/2016.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
1 Structure of Simple C++ Program Chapter 1 09/09/13.
Alice and Java Unit 7 1. Day 1  Objective: Gain an introduction to Java and Eclipse  Essential skill: DM-1: Use technology to advance critical thinking.
JavaScript and AJAX 2nd Edition Tutorial 1 Programming with JavaScript.
Intro to Web Performance Ten Ways to a Faster Website Presented by: Sheila Eaton and Mohammad Durrani TechKnowFile, University of Toronto, May 5, 2016.
FRONT END OPTIMIZATION: TRADE-OFFS YOU'RE FORCED TO MAKE BY KYLE GENTRY.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
Enhance Your Page Load Speed And Improve Traffic.
© 2010 Robert K. Moniot1 Chapter 6 Introduction to JavaScript.
Appendix A Barb Ericson Georgia Institute of Technology May 2006
Programming Web Pages with JavaScript
Tutorial 10 Programming with JavaScript
Appendix A Barb Ericson Georgia Institute of Technology May 2006
Building Web Applications with Microsoft ASP
Intro to JavaScript CS 1150 Spring 2017.
Michael Robertson Yuta Takayama Google Closure Tools.
Tips for Website Speed Optimization
JavaScript an introduction.
Web Systems Development (CSC-215)
Debuggers.
Homework Any Questions?.
Tutorial 10 Programming with JavaScript
Tutorial 10: Programming with javascript
How to debug a website using IE F12 tools
Standard Version of Starting Out with C++, 4th Edition
Workshop for Programming And Systems Management Teachers
Presentation transcript:

1 Minification JavaScript & CSS

2 Minification Removing 0 Whitespace 0 Line Breaks 0 Comments 0 Shrink Variables 0 Optimize Code

3 Why Minify? 0 Reducing file size cuts the time needed to send all the bytes over the Internet. 0 The Google TM Closure Compiler, a new minimization tool, finds ways to compress your JavaScript code even further than existing minimization tools. 0 It achieves additional compression by using compiler-like technology to rewrite your JavaScript into a much smaller form, while ensuring the code still runs correctly.

4 So the options are 0 The Google TM Closure Compiler 0 Provides the smallest and fastest code 0 YUI Compressor 0 The YUI Compressor is JavaScript minifier designed to be 100% safe and yield a higher compression ratio than most other tools. 0 JSMIN, the Dojo compressor and Dean Edwards' Packer

5 Dean Edwards' Packer 0 Not only compresses but also obfuscates. 0 How does it do what it does? (eval===evil?) 0 Why Obfuscation? 0 Is it really worth it?

6 Debugging 0 Minified Code very tricky to debug. 0 Different files in Dev. Environment and QA/Prod. Environment. 0 Fiddler2 – JavaScript Formatter 0 YSlow! - Tools

7 Biggest Challenge - ; insertion 0 How browsers work with JavaScript Actual Code i=10; while(i){ i-- } Browser Corrected Code i=10; while(i){ i--; //inserted }

8 The Silent Error block {.... } Might work well in other languages block {.... } Works well in JavaScript

9 Your style matters return { ok: false }; SILENT ERROR! return { ok: true }; Works well in JavaScript

10 Your style matters return { ok: false };

11 Your style matters return; // semicolon insertion { ok: false };

12 Your style matters return; { // block ok: false };

13 Your style matters return; { ok: false // label };

14 Your style matters return; { // useless ok: false // expression };

15 Your style matters return; { ok: false; // semicolon };

16 Your style matters return; { ok: false; }; // empty statement

17 Your style matters return; { // unreachable statement ok: false; }

18 Your style matters return { ok: false }; 0 Bad style return; { ok: false; } 0 Bad results

19 Payroll Example ~62%

20 Compressor Tool 0 Get all Static Content minified in one go. 0 Just copy the files to its directory and execute MinifyMe.bat 0 Uses Google TM Closure Compiler for JS Minification, YUI Compressor for CSS Minification and Dean Edwards Packer for Obfuscation. 0 Can be changed by editing compressor.vbs 0 Plans include recursive directories and image optimization using ImageMagick.

21 Minified Solutions 0 WebTop 0 Payroll

22 Thank You