background preloader

Closure Tools

Closure Tools
What is the Closure Compiler? The Closure Compiler is a tool for making JavaScript download and run faster. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what's left. How can I use the Closure Compiler? You can use the Closure Compiler as: An open source Java application that you can run from the command line. To get started with the compiler, see "How do I start" below. What are the benefits of using Closure Compiler? Efficiency. Related:  Outils, scripts et divers choses utiles

Underscore.js Closure Compiler - Javascript Compiler by Google - Compress Javascript with Closure Compiler Yesterday, Google introduced Closure Tools (announcement) to enable easy creation of web applications. The tool set contains: Closure Compiler, Closure Library and Closure Templates. Closure Compiler is a Javascript optimizer that compiles javascript code into a compact, high performance form. The compiler does more than a standard Javascript compressor. The Closure Compiler reduces the size of your JavaScript files and makes them more efficient, helping your application to load faster and reducing your bandwidth needs. Closure Compiler by Google - reduces the size of your JavaScript files and makes them more efficient As mentioned before, Closure compiler is more than a standard Javascript compressor. The compiler also offers a Firebug extension, named Inspector, for better debugging. Closure Compiler by Google does more than removing whitespace.

YUI Compressor According to Yahoo!'s Exceptional Performance Team, 40% to 60% of Yahoo!'s users have an empty cache experience and about 20% of all page views are done with an empty cache (see this article by Tenni Theurer on the YUIBlog for more information on browser cache usage). This fact outlines the importance of keeping web pages as lightweight as possible. In terms of code minification, the most widely used tools to minify JavaScript code are Douglas Crockford's JSMIN, the Dojo compressor and Dean Edwards' Packer. The goal of JavaScript and CSS minification is always to preserve the operational qualities of the code while reducing its overall byte footprint (both in raw terms and after gzipping, as most JavaScript and CSS served from production web servers is gzipped as part of the HTTP protocol). Documentation: Detailed description of the YUI Compressor and how to use it. How does the YUI Compressor work? Using the YUI Compressor from the command line Additional notes Support & Community

Project Silk: Client-Side Web Development for Modern Browsers patterns & practices Developer Center September 2011 Project Silk provides guidance for building maintainable cross-browser web applications that are characterized by an intentional design, rich interactivity, and a responsive user interface (UI), resulting in an immersive and engaging user experience (UX). Such applications take advantage of the latest web standards, including HTML5, CSS3, and ECMAScript version 5, and modern web technologies such as jQuery and ASP.NET MVC3. An intentional design indicates that deliberate attention was paid to the modularity of the JavaScript code, and the usability of the application was an explicit focus. Under the direction of the team's web designer, UI and UX concerns received special attention, and this guidance aims to help you be successful addressing these concerns in your own applications. This guidance is intended for web developers and assumes you have some hands-on experience with HTML, CSS, JavaScript, jQuery, and ASP.NET MVC.

Brian Ford The AngularJS documentation is great for getting started and for looking up specific API calls. However, it doesn't really tell you how to organize and manage your app as it grows to tens or hundreds of thousands of lines of code. I've collected here some of my observations and best practices for how to manage your sprawling application. Don't Write a Huge App The best advice about huge apps is not to make them. Organization Probably the biggest question with large apps is where to put all of that code. Directories This is the typical folder layout that I recommend: root-app-folder ├── index.html ├── scripts │ ├── controllers │ │ └── main.js │ │ └── ... │ ├── directives │ │ └── myDirective.js │ │ └── ... │ ├── filters │ │ └── myFilter.js │ │ └── ... │ ├── services │ │ └── myService.js │ │ └── ... │ ├── vendor │ │ ├── angular.js │ │ ├── angular.min.js │ │ ├── es5-shim.min.js │ │ └── json3.min.js │ └── app.js ├── styles │ └── ... └── views ├── main.html └── ... Files Modules Dependencies Models

Mouse wheel programming in JavaScript Quick links: source · test page · long test page (with scrollbars) · compatibility Though many people still find this page useful, there have been some changes in the browsers since last update of this page, and I generally consider some information here to be outdated. However, I suggest using MooTools or other general Javascript frameworks that provide portable and maintainable basis for writing Javascript code. Web applications are becoming more and more like “normal” desktop applications. Of course, they are more and more functional, but smooth user interface acts the primary role. So we have drag and drop, autocompletition, and much more. This page, however, is not about AJAX (or any other buzzword). Annotated code Below is annotated javascript code, which should explain the magic behind mouse wheel generated events. /** This is high-level function. * It must react to delta being more/less than zero. Handler function If delta is positive, wheel was scrolled up. Compatability Usability

uglify-js UglifyJS is a JavaScript parser, minifier, compressor and beautifier toolkit. Note: uglify-js@3 has a simplified API and CLI that is not backwards compatible with uglify-js@2.Documentation for UglifyJS 2.x releases can be found here.uglify-js only supports JavaScript (ECMAScript 5).To minify ECMAScript 2015 or above, transpile using tools like Babel. Install First make sure you have installed the latest version of node.js (You may need to restart your computer after this step). From NPM for use as a command line app: npm install uglify-js -g From NPM for programmatic use: npm install uglify-js uglifyjs [input files] [options] UglifyJS can take multiple input files. If no input file is specified, UglifyJS will read from STDIN. If you wish to pass your options before the input files, separate the two with a double dash to prevent input files being used as option arguments: uglifyjs --compress --mangle -- input.js Command line options -h, --help Print usage information. CLI source map options Example: fs

Crockford on JavaScript -- Volume 1: The Early Years - Douglas Crockford - YUI Theater ▶ Play His talk is entitled "Polymer, Building blocks for the web" with the following description. From "a" to "select", elements are the building blocks of the web. But modern applications have outgrown these built-in elements, forcing app developers to rely on JavaScript frameworks to provide dynamic, custom behavior. The resulting apps are frequently complex and monolithic; a component developed for one may not work in another. In this talk we'll take a look at Polymer, a new library that allows developers to create their own HTML elements and compose them into complete applications. Rob Dodson is a Developer Advocate for the Google Chrome team, focusing on Polymer and web components.

Jehu/ng-mobile

Related: