Comments (6)
You definitely can, as Polymer 2/3 elements and LitElement are all based on webcomponents. For example, this JSBin (http://jsbin.com/pokuwururi/edit?html,output) works in Firefox 60 and Chrome using both a Polymer 2 element as well as the LitElement example. (network could be a bit slow, just because it does a lot of network requests)
However, you are then responsible for doing the integration yourself, meaning you have to take care of the HTML imports and ES modules orchestration. Therefore, we advise you to use Polymer 3 and LitElement together, as they are both based on the same loading mechanism ES modules.
from lit-element.
@TimvdLippe That's an interesting snippet, thanks for posting that!
The only issue with this I can think of here is duplicate element definitions. For instance both Polymer 2 and 3 will try to register dom-if, dom-repeat etc. right?
from lit-element.
from lit-element.
Yes, @TimvdLippe is right, but I still have a problem. This snippet works great but is still a html file, previously in a JS file, I could do this:
import {LitElement, html} from 'https://unpkg.com/@polymer/lit-element@latest/lit-element.js?module';
import { importHref } from '@polymer/polymer/lib/utils/import-href';
importHref( 'https://polygit.org/polymer+:2.x/paper-checkbox+polymerelements+:master/components/paper-checkbox/paper-checkbox.html', null, null, true);
class MyElement extends LitElement {
static get properties() { return { mood: String }}
_render({mood}) {
return html`<style> .mood { color: green; } </style>
Web Components are <span class="mood">${mood}</span>!
<paper-checkbox></paper-checkbox>`;
}
}
customElements.define('my-element', MyElement);
But now this function is removed, is there a clean solution? or should I replicate the previous importHref polymer function?
from lit-element.
from lit-element.
ok, thanks!
from lit-element.
Related Issues (20)
- Typescript error on latest build HOT 1
- mixins don't work when using ESNext in tsconfig to compile HOT 1
- Error throw when accessing queryAssignedNodes getter (No version >2.4.0) HOT 1
- Support for contexts? HOT 2
- Persistance? HOT 5
- idempotent/soft customElement decorator HOT 1
- state() is shown as deprecated in LitElement 2.5 HOT 1
- Should not be necessary to copy TemplateResult
- jsdelivr/+esm: [object Object] HOT 1
- Nested components, slot and text styling HOT 1
- Git tags are not in sync with npm tags HOT 2
- No release major/minor branches available for reference. HOT 2
- Move tests and benchmarks to GitHub Actions
- Accessibility => lit-element + Google Chrome Screen Reader Extension => UI Design is Changed HOT 3
- Property does not re-render when fired from custom event HOT 4
- Add a way to know when rendering of an element, and ALL its sub-elements, is finished HOT 3
- Litelement Boolean property returns undefined in when not set HOT 6
- Forward Compatibility With Lit 2 misleading HOT 2
- Starter projects missing in getting started documentation HOT 1
- How do you get the actual click event target? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lit-element.