1

I written a website using dart and polymer, it runs well in Chromium, but cannot get it compiled to js.

The directory layout is like:

my_proj/
  pubspec.yaml            (Contents below)
  lib/
    some_code.dart ...    (Used by index.dart, app.dart and custom_elem_x.dart)
  asset/
    3rd-party codes ...   (CSS, JS lib, etc.)
  web/
    index.html            (Traditional HTML, no polymer stuff)
    app.html              (Use lots of custom elements written in polymer)
    script/
      index.dart          (Pure dart, nothing fancy, has a main())
      app.dart            (Has a main(), in which initPolymer() get called)
    polymer/
      custom_elem_1.html  (Imported by app.html via \
      custom_elem_1.dart   <link rel="import" href="polymer/custom_elem_1.html">)
      ...
      custom_elem_n.html
      custom_elem_n.dart

pubspec.yaml:

name: blah
dependencies:
  browser: any
  polymer: any
  ...
transformers:
- polymer:
    entry_points: web/app.html
- $dart2js:
    minify: true

If I run pub build under my_proj/, there is no error as far as I can tell, (lots of warnings, though). But the index.html is static (just contents, no actions), and the custom element in app.html is not rendering. Any idea what caused this?

I am using dart-sdk 1.2.1 (pub --version) on Debian 7 32bit.

Thanks.

Edit

Managed to fix it by deleting all packages/ in project dir, and running pub get again. custom_element, shadow_dom, html5lib get updated to 0.9.2, seems these updates got it fixed, because I put get several times before, and nothing worked.

Not an ID
  • 2,579
  • 2
  • 21
  • 28
  • What code do you have in index.dart? When you open development console in the browser, do you get any messages (files that could not be loaded, ...)? – Günter Zöchbauer Mar 06 '14 at 11:14
  • Insert some Elements to DOM, querySelect to get some value, HttpRequest it to server, that kind of stuff. No out for index.dart in console, Get it fixed by `pub get` again, see my edit. Thanks. – Not an ID Mar 06 '14 at 12:04
  • You should use `pub upgrade` to get the most recent package versions. `pub get` is only for initial download or to get the package versions listed in `pubspec.lock`. – Günter Zöchbauer Mar 06 '14 at 12:25
  • please check the answer to this question http://stackoverflow.com/questions/20932180. Code in main should be run from `initPolymer().run(() {... });` if it deals with polymer elements. – Günter Zöchbauer Mar 06 '14 at 12:26
  • Thanks for the `initPolymer().run(() {... });`, seems very useful. – Not an ID Mar 06 '14 at 15:04

0 Answers0