Up today, I try to hack Polymer.dart, Dart Pub, and dart2js in the most horrible ways possible.
The end goal is to get a
<polymer-element>templates directly in the transformed HTML:
<!DOCTYPE html><html lang="en"> <head> <script src="packages/shadow_dom/shadow_dom.debug.js"></script> <script src="packages/custom_element/custom-elements.debug.js"></script> <script src="packages/browser/interop.js"></script> <!-- Load component(s) --> <!-- Load Polymer --> <script src="index.html_bootstrap.dart.js"></script> </head> <body> <polymer-element name="x-pizza-toppings"> <template><!-- ... --></template> </polymer-element> <polymer-element name="x-pizza"> <template><!-- ... --></template> </polymer-element> <div class="container"> <h1>Ye Olde Dart Pizza Shoppe</h1> <x-pizza></x-pizza> </div> </body></html>In the previous days, I have managed to manually combine all of that (
Except if I can't
It turns out that much of dart2js transformer code is, naturally enough, part of Dart's internals instead of Barback or Polymer.
I cannot use the
Dart2JSTransformerfrom internal without compiling Dart from source, which… ugh. It's not that it's a ton of work—just a yak that I do not want to shave tonight for exploring Polymer. So I spend some time looking through the
dart2jsoptions that are used by the transformer in the hopes that I am missing some magical setting that would pick up my missing Polymer annotations.
In the end, however, I am unsuccessful. Bother. I think it best to drop this line of exploration for now. There are still a few other avenues of exploration that I need to tackle before Patterns in Polymer is finally done and this avenue is proving less and less fruitful. I will likely throw together a quick shell script tomorrow and then move on. Time permitting, I will return here and investigate compiler Dart so that I have more access to the internal libraries.