Google Closure Tools

Stato
Discussione chiusa ad ulteriori risposte.

HackLife

Utente Silver
26 Maggio 2008
57
11
0
73
Dedicato ai web dev.
Codice:
 Web applications have evolved from simple HTML pages into rich, interactive applications that provide a great user experience. Today's web apps pose a challenge for developers, however: how do you create and maintain efficient JavaScript code that downloads quickly and works across different browsers?

The Closure tools help developers to build rich web applications with JavaScript that is both powerful and efficient. The Closure tools include:
A JavaScript optimizer

The Closure Compiler compiles JavaScript into compact, high-performance code. The compiler removes dead code and rewrites and minimizes what's left so that it downloads and runs quickly. It also also checks syntax, variable references, and types, and warns about common JavaScript pitfalls. These checks and optimizations help you write apps that are less buggy and easier to maintain. You can use the compiler with Closure Inspector, a Firebug extension that makes debugging the obfuscated code almost as easy as debugging the human-readable source.
A comprehensive JavaScript library

The Closure Library is a broad, well-tested, modular, and cross-browser JavaScript library. You can pull just what you need from a large set of reusable UI widgets and controls, and from lower-level utilities for DOM manipulation, server communication, animation, data structures, unit testing, rich-text editing, and more.

The Closure Library is server-agnostic, and is intended for use with the Closure Compiler.
An easy templating system for both Java & JavaScript

Closure Templates simplify the task of dynamically generating HTML. They have a simple syntax that is natural for programmers. In contrast to traditional templating systems, in which you use one big template per page, you can think of Closure Templates as small components that you compose to form your user interface.

Closure Templates are implemented for both JavaScript and Java, so that you can use the same templates on both the server and client side. For the client side, Closure Templates are precompiled into efficient JavaScript.
Link: http://code.google.com/intl/it-IT/closure/
 
ho visto cosa fa il closure compiler e mi viene da dire: dove ho già visto 'sta roba? Mi par di ricordare che esisteva già un ottimizzatore simile che provvedeva a rimuovere qualsiasi carattere inutile da js e css, se mi ricordo come si chiama trovo anche il link.

EDIT: ecco un esempio http://refresh-sf.com/yui/ , ma sicuramente ne esistono anche altri
 
Malex ha detto:
ho visto cosa fa il closure compiler e mi viene da dire: dove ho già visto 'sta roba? Mi par di ricordare che esisteva già un ottimizzatore simile che provvedeva a rimuovere qualsiasi carattere inutile da js e css, se mi ricordo come si chiama trovo anche il link.

EDIT: ecco un esempio http://refresh-sf.com/yui/ , ma sicuramente ne esistono anche altri

Si e' pieno di roba del genere, ma probabilmente questo, visto che limitano il numero di compilazioni possibili in un certo tempo, sfrutta V8 per analizzare il sorgente e trovare parti removibili/ottimizzabili.
 
il primo passo verso l'ottimizzazione è avere un .css unico, cosa che poi molte persone (e team) non fanno nei loro siti/cms, poi si dovrebbe passare alla rimozione di stili inutili (che potrebbero essere applicati ad es. a tag madri) e quindi utilizzare gli accorgimenti di accorciamento (es. #000=#000000), poi se vuoi comprimi quanto ti pare XD
 
Stato
Discussione chiusa ad ulteriori risposte.