polymer-dart / todo_ddc

15 stars 3 forks source link

Simple example #11

Closed Hecatoncheir closed 7 years ago

Hecatoncheir commented 7 years ago

Need more simple example for show how to use polymerize. I have some structure of files: https://gist.github.com/Rasarts/978a83559413291b02a759a9ce797797

When I run pub serve, I get:

Loading source assets... 
Serving polymer_dcc web on http://localhost:8080
Build completed successfully
[web] GET  → (cached) polymer_dcc|web/index.html
[web] GET require.js → Could not find asset polymer_dcc|web/require.js.
[web] GET polymer_element/src/webcomponentsjs/webcomponents-lite.js → Could not find asset polymer_dcc|web/polymer_element/src/webcomponentsjs/webcomponents-lite.js.
[web] GET polymer_element/src/polymer/polymer.html → Could not find asset polymer_dcc|web/polymer_element/src/polymer/polymer.html.
[web] GET polymer_dcc/my_other_tag.html → Could not find asset polymer_dcc|web/polymer_dcc/my_other_tag.html.

my_other_tag.html ?

In browser I get nothing, but in browser console:

localhost/:3 GET http://localhost:8080/require.js 
localhost/:4 GET http://localhost:8080/polymer_element/src/webcomponentsjs/webcomponents-lite.js 
localhost/:5 GET http://localhost:8080/polymer_element/src/polymer/polymer.html 404 (Not Found)
localhost/:6 GET http://localhost:8080/polymer_dcc/my_other_tag.html 404 (Not Found)

How I can make this work with polymerize?

_Dart VM version: 1.24.2 (Thu Jun 22 08:43:26 2017) on "linuxx64" Google Chrome: Version 59.0.3071.115 (Official Build) (64-bit)

dam0vm3nt commented 7 years ago

There were some problems with the component module. I've also changed the name of some file to be more "dart compliant" (underscore instead of dashes in file names).

Check out this repo to see the changes :

https://github.com/polymer-dart/simple_example

dam0vm3nt commented 7 years ago

Note : I've left as much closer to your original files as possibile but notice that you can remove the library tag everywhere and still it would work. The connectedCallback is also optional but if you override it you must call the super implementation (like you did) because on how webcomponents v1 works (you are forced to call it even in js land).

dam0vm3nt commented 7 years ago

You can also check the simplified_1 branch for an even simpler example.

Hecatoncheir commented 7 years ago

Thanks, for your answer. To MyTag class I added:

 connectedCallback() {
    super.connectedCallback();
  }

Tried to run, and I get in browser console errors:

htmlimport.js:11 GET http://localhost:8080/bower_components/polymer/lib/elements/dom-repeat.html 404 (Not Found)
htmlimport.js:11 GET http://localhost:8080/bower_components/polymer/lib/elements/dom-if.html 
htmlimport.js:11 GET http://localhost:8080/bower_components/polymer/lib/legacy/templatizer-behavior.html 
htmlimport.js:11 GET http://localhost:8080/bower_components/polymer/lib/mixins/property-effects.html 
htmlimport.js:11 GET http://localhost:8080/bower_components/polymer/lib/utils/templatize.html 
htmlimport.js:11 GET http://localhost:8080/bower_components/polymer/lib/legacy/mutable-data-behavior.html 404 (Not Found)
htmlimport.js:11 GET http://localhost:8080/bower_components/polymer/lib/mixins/mutable-data.html 404 (Not Found)
htmlimport.js:11 GET http://localhost:8080/bower_components/polymer/lib/mixins/element-mixin.html 404 (Not Found)
htmlimport.js:11 GET http://localhost:8080/bower_components/polymer/polymer.html 404 (Not Found)

Uncaught Error: Load timeout for modules: polymerize_require/htmlimport!bower_components/polymer/lib/elements/dom-repeat.html_unnormalized3,polymerize_require/htmlimport!bower_components/polymer/lib/elements/dom-if.html_unnormalized4,polymerize_require/htmlimport!bower_components/polymer/lib/legacy/templatizer-behavior.html_unnormalized5,polymerize_require/htmlimport!bower_components/polymer/lib/mixins/property-effects.html_unnormalized6,polymerize_require/htmlimport!bower_components/polymer/lib/utils/templatize.html_unnormalized7,polymerize_require/htmlimport!bower_components/polymer/lib/legacy/mutable-data-behavior.html_unnormalized8,polymerize_require/htmlimport!bower_components/polymer/lib/mixins/mutable-data.html_unnormalized9,polymerize_require/htmlimport!bower_components/polymer/lib/mixins/element-mixin.html_unnormalized10,polymerize_require/htmlimport!bower_components/polymer/polymer.html_unnormalized11,polymerize_require/htmlimport!bower_components/polymer/lib/elements/dom-repeat.html,polymerize_require/htmlimport!bower_components/polymer/lib/elements/dom-if.html,polymerize_require/htmlimport!bower_components/polymer/lib/legacy/templatizer-behavior.html,polymerize_require/htmlimport!bower_components/polymer/lib/mixins/property-effects.html,polymerize_require/htmlimport!bower_components/polymer/lib/utils/templatize.html,polymerize_require/htmlimport!bower_components/polymer/lib/legacy/mutable-data-behavior.html,polymerize_require/htmlimport!bower_components/polymer/lib/mixins/mutable-data.html,polymerize_require/htmlimport!bower_components/polymer/lib/mixins/element-mixin.html,polymerize_require/htmlimport!bower_components/polymer/polymer.html
http://requirejs.org/docs/errors.html#timeout
    at makeError (require.js:168)
    at checkLoaded (require.js:698)
    at require.js:719
dam0vm3nt commented 7 years ago

You added it to simiplfied_1 right ? Because in the master there is already.

Anyway seams like it failed downloading components from bower during the build phase.

Please check your network or try again (maybe it was a temporary network failure).

polymerize requires to download the bower library every time. Fortunately it leverages bower cache but sometimes it needs to access the repositories even if only to check the current versions.

I'm planning to add an "offline" flag to allow for building only with cached artifacts anyway.

Hecatoncheir commented 7 years ago

Yes, I try simiplfied_1. I think I understood. I will try repair my proxy. Thanks.

dam0vm3nt commented 7 years ago

I'm closing this. Feel free to reopen or open another issue if there's any other problem.