
Security News
ECMAScript 2025 Finalized with Iterator Helpers, Set Methods, RegExp.escape, and More
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
@popeindustries/lit-element
Advanced tools
Enable hydration of lit-element elements rendered on the server with @popeindustries/lit-html-server
Seamlessly and efficiently use @popeindustries/lit-html-server rendered HTML to hydrate lit-element web components in the browser, including lazy hydration with hydrate:idle
or hydrate:visible
attributes.
Install with npm/yarn/pnpm
:
$ npm install --save @popeindustries/lit-element
Create a web component:
import { css, html, LitElement } from '@popeindustries/lit-element';
class MyEl extends LitElement {
static styles = css`
p {
color: green;
}
`;
render() {
return html`<p>I am green!</p>`;
}
}
customElements.define('my-el', MyEl);
...render a page template on the server with @popeindustries/lit-html-server
:
import './my-el.js';
import { html, renderToNodeStream } from '@popeindustries/lit-html-server';
import { hydratable } from '@popeindustries/lit-html-server/directives/hydratable.js';
import { LitElementRenderer } from '@popeindustries/lit-element/lit-element-renderer.js';
import http from 'node:http';
http.createServer(
(request, response) => {
response.writeHead(200);
renderToNodeStream(html`<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>LitElement example</title>
</head>
<body>
<my-el></my-el>
</body>
</html>`).pipe(response);
},
{
// Register a renderer for LitElement components
renderers: [LitElementRenderer],
},
);
...and import the same web component in the browser to trigger hydration/render on changes:
import './my-el.js';
// Trigger hydration/initial update
document.querySelector('body > my-el').removeAttribute('hydrate:defer');
Note Due to how the
lit*
family of packages are minified and mangled for production, the@popeindustries/lit-element
package is forced to vendor all dependencies tolit-element
and@lit/reactive-element
packages. This shouldn't affect normal use as long as application code does not mix imports from@popeindustries/lit-element
andlit-element
.
FAQs
Enable hydration of lit-element elements rendered on the server with @popeindustries/lit-html-server
The npm package @popeindustries/lit-element receives a total of 809 weekly downloads. As such, @popeindustries/lit-element popularity was classified as not popular.
We found that @popeindustries/lit-element demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ECMAScript 2025 introduces Iterator Helpers, Set methods, JSON modules, and more in its latest spec update approved by Ecma in June 2025.
Security News
A new Node.js homepage button linking to paid support for EOL versions has sparked a heated discussion among contributors and the wider community.
Research
North Korean threat actors linked to the Contagious Interview campaign return with 35 new malicious npm packages using a stealthy multi-stage malware loader.