Is there minifying Dart scripts in a roadmap? - compression

I am at the beginning of my adventure with Dart, do please be kind :)
I found some answers related to minifying JS files made from Dart (dart2js), but I cannot find any info about minifying Dart code itself.
Is there any plan to do this?
For JS there are some tools i.e. YUI Compressor.
I think Dart need also such application.
--
Best regards,
Tom

You can use dart2js with the --output-type=dart to output Dart code instead of JavaScript. Coupled with the --minify option you will get a minified dart file.

Looking at the dart tools page: https://www.dartlang.org/docs/dart-up-and-running/contents/ch04-tools-dart2js.html
There are a few things that are perhaps relevant:
--output-type=dart
Output Dart code instead of JavaScript. This option is useful when deploying your app, because it generates a single file
containing everything the app needs.
And tree-shaking removes unused code:
Don’t worry about the size of your app’s included libraries. Thanks to a feature called tree shaking, dart2js omits unused classes, functions, methods, and so on. Just import the libraries you need, and let dart2js get rid of what you don’t need.

Don't know if browser can load snapshot, and never tried. But if so, could fit your needs: https://www.dartlang.org/articles/snapshots/

Related

What does `ember build` exactly do

I would like to know what is included in a process of building web-application with ember build, as I know that JavaScript is interpreted language and does not require compilation (unlike Java or C++).
You are right that JavaScript is interpreted and not compiled language. You also most probably know that in web-development we use <script> tags to include JavaScript code into html pages. But at some point web-application grows so big that developer needs to break js code into few files. That's not a problem - we can have 2 or 3 or 5 script tags. However for bigger apps, for which we need frameworks like ember, we need to break code into tens or even hundreds of files. But having tens of script tags on page is different thing than having 2-3 - large amount of external resources slows down page load process. That's a first problem. It means that developers need a tool to at least concatenate all files into one.
Other problem - our js code is pretty formatted. But formatting means a lot of extra bytes - spaces/tabs, new lines, long variable names. And all that extra bytes slow down page load, too. To solve this problem other tools were invented - uglyfiers, which take formatted code and strip all those extra bytes.
Next, it's more convenient not to just concatenate all js files in correct order but to have some module system to isolate code in each module and then require that module in any other. But then concatenate all that in one file and uglify it.
And have you ever heard about es6? It's a new, better js standard but it's still not supported by all browsers. To use its features you need a tool that will convert (transpile) es6 code to es5 (which is supported everywhere). That tool is called "babel".
Also, sometimes developers need to manage non-js assets, like css or images - concatenate styles, move images around.
Building is a process of running all these tasks to convert a lot of pretty source files into one ugly but effective. Ember-cli is a toolset to do all that things and ember build runs all needed tasks to build web-application. Some other frameworks may have their own toolset and if you don't use any framework, tools like gulp and webpack exist which are framework-agnostic and help to create your own build process.
I hope I answered your question. In fact, ember-cli does more work than I described, you can find more features and details at ember-cli.com.

Setting up testing of an Ember boilerplate on JSBin.com

I'm learning Ember basics running the code online in the awesome http://ember.jsbin.com/ code fiddling service. It provides a basic boilerplate of an HTML file, a CSS file and a JS file.
I wonder how can use it to run unit tests of my Ember app.
My goal is to be able to run the app and the tests from a single JSBin instance. I imagine switching between the two modes by adding/removing ?test in the URL, or something like that.
Yeah it's highly unlikely that this will work. Unit tests should be run by cmd.
Okay, i gave it another try and found that official Ember Guides contain a demo of how it can be done in JSBin.com!
Demo: http://jsbin.com/jesuyeri/20/edit?js,output
Relevant guides page: http://emberjs.com/guides/testing/test-helpers/

How to use Google Blink/Webkit to render HTML code

Sorry if the title somewhat ambiguous.
I'm buliding an app that recieve an URL then return the final HTML code (and save it for caching), after Ajax and other js feature executed (something like Phantomjs).
My language can call C++ code, so I think it would be nice if I can buid and use Blink/Webkit libary directly.
The issue is both Blink/Webkit document is too big.
UPDATE 1: Which API (Blink has many APIlayer) or a particular class I need to look at?
Do you know any example or tutorial I should look at?
Or any alternative simpler libary?
Thanks
Finally Chromium project have headless API in development with very good example which can be build using ninja, more information in their project at https://chromium.googlesource.com/chromium/src/+/master/headless/
A video from BlinkOn https://www.youtube.com/watch?v=GivjumRiZ8c&t=838s

manage and compile large emberjs app

Ember don't seems to play well with requirejs or building with r.js without some hackery.
Bit hard to manage a large application, I like to break down my file structure as HMVC, which manages modules bit easier :
app
- blah
- modules
-module1
- controller
- model
- view.
Has anyone come up a build stack to automate the compilation into single file with dependency management?
Update: You should now be starting new projects using ember-cli, which provides all the build/dev tools plus many other useful features.
Original answer:
An example Ember project using grunt.js as a build system:
https://github.com/trek/ember-todos-with-build-tools-tests-and-other-modern-conveniences
I've used this as a starting point for some Ember apps and it works well.
Ember don't seems to play well with requirejs or building with r.js without some hackery.
Why do you want to use require.js in the first place?
As for making this all work you'll need a build tool. I recommend brunch (Node) or iridium (Ruby). Brunch is more simple and supports many different module formats. Iridium is much more powerful. It uses Minispade for modules. Require.js/AMD is not needed because your js is always delivered as a single concatenated file.
For stand-alone ember dev I use ember-skeleton as a starting point, which is itself based primarily on rake-pipeline.
https://github.com/interline/ember-skeleton
This provides the whole kit-and-kaboodle for beginning an app, but the meat of it is the rake-p Assetfile, which describes how rake-pipeline will digest all the files, filter their contents, and ultimately combine them into the final handful of files. Additionally, the combination of loader.js and the minispade filter allows the use of 'require()' statements for managing dependencies amongst your files.

How do I build reusable JSP snippets in an app

I want to build reusable JSP components for an application that I am building. There are multiple ways to go around this. The ones that I know of include building JSPFragments and then stitching the page the together. But that is not an elegant way of doing it.
I am also trying to get mt head around JSP tag libraries to be able to build reusable components for JSP. I read in multiple places that tag libraries are falling out of favour fast. There are other frameworks like JSF and Freemarker templates by which I can build re-usable components. What do I use to build these components. Is there a preferred and contemporary approach I can follow?
I am not sure if this solve your problem. But anyway, I started to use FreeMarker, which is a really good template engine. It follows strict the MVC principal. These feature might help you to decide whether FreeMarker is good for your needs:
Including strategy. This is what I use to include header and footer template files in my view.
Macros. Maybe you want but write your own directives. Unfortunately I have no experience with that.
Using jsp taglibs with FreeMarker is also possible.
Note that FreeMarker is just a template engine. You can not include java code into html like with jsp.
If the component is simple you can use .tag files. They are easy to write. If it is more complex, use a tag library. It is a working solution used many times.