Showing posts from January, 2014

How to shrink the size of your Dart app when compiled to JavaScript

So you caught the Dart bug and you're enjoying using the structured language, comprehensive libraries, and productive tools. Great! Except, when you compiled your Dart app to JavaScript, the output was bigger than expected. Read this post to learn how to reduce the size of your JavaScript output. Small apps are fast apps! Make sure you are minifying The dart2js compiler can minify your JavaScript. However, minification is not the default. Make sure you opt-into minification before you deploy to production. How can you tell if you minified? Take a look at the generated JavaScript and you'll know. Minified JavaScript replaces variables names, function names, and more with shorter names. It also moves code around to use less lines. If you compile your app from the command line, use --minify: dart2js --minify -o=app.dart.js app.dart If you use pub build (a streamlined build process for pub package and apps), it defaults to minifying. Yay! If you use Dart Editor, it&