How to deploy a Polymer dart application
Asked Answered
K

2

7

I have a dart application using Polymer.dart, i replace the dart.js file by the boot.js (in my index.html), an now i want to deploy this application in order to have a working javascript one.

But, when i launch the build.dart, i have :

Total time spent on web/index.html                           -- 504 ms
Total time                                                   -- 555 ms

but nothing is created, no more "out" folder. And when I do Pub Deploy, it create a "deploy" folder, but that version is not working (because the build.dart doesn't properly work i think).

Have you any idea?

Kilmer answered 24/8, 2013 at 14:27 Comment(0)
S
8

Right now, it's a two step process. I suspect this will get easier. In the meantime:

Create a build.dart that looks like this:

import 'package:polymer/builder.dart';
main() {
  build(entryPoints: ['web/index.html'], options: parseOptions(['--deploy']));
}

Take note, currently, a lot of warnings and hints are produced. You can ignore them for right now.

Stormy answered 26/8, 2013 at 13:54 Comment(7)
Thanks Seth, But i can not deploy the version which is now under /out, I have an error : Breaking on exception: Bad state: No elements I signaled it in the bug tracker : code.google.com/p/dart/issues/detail?id=12732Kilmer
This isn't working for me: "Breaking on exception: FormatException: Could not find an option named "deploy".Derwon
@BrianSlesinsky I'm getting the same. :(Nagey
Since 0.7.1 the extra arguments are dropped and you need polymer/deploy.dart for build(args, entry).then( (_) => deploy.main()). However, I cant get the js from pub deploy to work with any browser :(Cuckoopint
JS compilation does not works for me either. On the one hand I'm really regretting about migrating to polymer from web_ui. On the other hand there were things in web_ui that did not work and now work in polymer. Looks like web_ui was dropped half-way through the implementation, and polymer is only half-way completed. Really sad :(Kweisui
Since 0.7.6+ use: import 'package:polymer/builder.dart'; and then call build(entryPoints: ['web/index.html']);Autecology
Step 2 in the two step process is right clicking the entry point and choosing 'Build Polymer App', right? And step 3 is running the app as Javascript.Phantasy
A
1

For the current version i have done these steps :

type on your console: dart build.dart --deploy dart2js out/web/index.html_bootstrap.dart -oout/web/index.html_bootstrap.dart.js

index.html:

<!DOCTYPE html>
<html>
  <head>
    ...    
    <link rel="import" href="clickcounter.html">

    <script type="application/dart">export 'package:polymer/init.dart';</script>
    <script src="packages/browser/dart.js"></script>
  </head>
  <body>
    ... 
    <div id="sample_container_id">
      <click-counter count="5"></click-counter>
    </div>
  </body>
</html>

build.dart:

import 'package:polymer/builder.dart';   
main(args) {
  build(entryPoints: ['web/aaa.html'],
    options: parseOptions(args));
}
Aldrin answered 19/12, 2013 at 13:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.