-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tried to use polymer without loading it first error. #502
Comments
Afaict, |
So what is the difference between that code and this demo for another repo I made that works? https://github.com/badseycc/badsey-player/blob/master/demo/src/index.html.jade |
The difference is that https://github.com/badseycc/badsey-player/blob/master/dist/badsey-player.html includes an import to polymer-ui-toggle-button (though this should be at the top of the file rather than being in the The general rule of thumb is, if you're building an element using |
This is not a correct fix and you will have errors. Instead, your element should import |
Ok I'll change that then, thanks. On 14 May 2014 21:55, Scott J. Miles [email protected] wrote:
|
@ryansmith94 what you'll want to do is something like this. Take a look at the untitled-element starter project and follow the Getting Started guide in the readme. That should set you on right track 😸 |
Fwiw, I know this can seem nitpicky. The reason we want you to treat In the old days, your application ( In the new world, your application simply uses custom-elements ( |
@robdodson Thanks for that 😄 @sjmiles That's cool, I understand that, I really like where this is taking the web so I'm happy to follow along with your best practises. |
Is there a way to import this from a CDN or do I have to use Bower? I'm really not a fan of package managers, it just seems like extra hassle because you have to put a reference in the source anyway. Would be cool if there was something that read your source code, found and installed your dependencies. |
So to continue my nitpicky ways, let me say that "import from CDN" and "use Bower" are apples and oranges. IOW, there is a fair question which is: can I import from CDN, or do I have to have component-x installed locally? But this question is distinct from "use Bower" which is about how to get component-x installed locally. Today, you cannot in general import some stuff from CDN and have other stuff imported locally. This is because if one component imports There is work ongoing to increase flexibility in this area, but right now you should avoid using CDN for anything that is imported. As far as how to get The idea of having a tool that looks at the source and pulls down the necessary dependencies is interesting (but this would still be a package manager =P). |
Ok, thanks for that explanation.
Yeah I guess it would be a package manager, maybe a grunt or gulp plugin could look at the files and find the dependencies but use a package manager like bower or npm to install them. Thanks for all of your thorough replies, I really appreciate it. 😄 |
This seems a bit circularly defined: you're supposed to import polymer.html at the top of the file, which currently includes the script polymer.js, which runs the polyfill code. However if your browser doesn't yet support HTML imports, and using an HTML import is the only right way to include Polymer, you're stuck. Optionally, you could include the script polymer.js (or webcomponents.js) yourself above the import of polymer.html, so that old browsers can handle the import, but then you get two copies of polymer (potentially different versions) being run. I'm seeing this issue right now with HTML imports not working on Firefox. I think the only solution is to manually run webcomponents.js before the HTML import? |
Yes, for browsers that don't support the native APIs you need to load webcomponents.js in your main index.html page, before any HTML imports and other JS that touches the DOM. It's our recommendation to continue to include this file. |
Hello guys I'm trying to wrap my head around this as well. To clarify then, for every element (e.g. created by using yo polymer:element), it has to include |
@toadkicker if your element is importing other elements that also import polymer, then you can skip it. Otherwise, yes. It ensures that the dependencies are loaded before your element attempts to register. |
Really struggling to figure out why I am receiving this error (see below).
Source code can be found at badseycc/fantasy-cricket.
The text was updated successfully, but these errors were encountered: