Giter Club home page Giter Club logo

litre's Introduction




Deno + LitHTML: No build, no bundle, all streaming

Litre is a web framework intended to work with LitHTML and SSR

Embrace the future of ES Modules, Import Maps, and Web Streams.

Starting Litre server

import { start } from 'https://raw.githubusercontent.com/Stradivario/litre/master/src/mod.ts';

start({
  importmap: await Deno.readTextFile('importmap.json'),
  folder: 'app',
  port: 4200,
});
make dev

HTMLElement

class AppRoot extends HTMLElement {
  constructor() {
    super();
    this.attachShadow({ mode: "open" });
  }
  connectedCallback() {
    const div = document.createElement("div");
    div.innerHTML = `Hello from SSR Webcomponents using Deno!`;
    this.shadowRoot?.append(div);
  }
}

customElements.define('app-root', AppRoot)

export default Litre({
  page: () => Ocean.html`
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <title>My app</title>
      </head>
      <body>
        <app-root></app-root>
      </body>
    </html>
  `,
});

LitHTML

import {
  html,
  Component,
  LitElement,
} from 'https://cdn.esm.sh/v53/@rxdi/[email protected]';

@Component({
  selector: 'app-root',
  template(this) {
    return html`Hello from SSR Webcomponents using Deno!`;
  },
})
export class AppRoot extends LitElement {}

export default Litre({
  page: () => Ocean.html`
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8">
        <title>My app</title>
      </head>
      <body>
        <app-root></app-root>
      </body>
    </html>
  `,
});

Partially Hydrated server side rendering

We define components to be loaded after javascript is loaded

import {
  Component,
  html,
  LitElement,
} from 'http://localhost:8080/@rxdi/lit-html';

@Component({
  selector: 'app-root',
  template(this) {
    return html`
      <rx-button palette="danger">Test Button</rx-button>
      <rx-accordion-item>
        <div slot="title">Why should i upgrade ?</div>
        <div slot="content">Optimized for best experience...</div>
      </rx-accordion-item> `;
  },
})
export class AppRoot extends LitElement {}

export default Litre({
  page: () => Ocean.html`
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="UTF-8" />
        <title>My app</title>
        <script type="module">
          import 'http://localhost:8080/@rxdi/ui-kit/accordion-item';
          import 'http://localhost:8080/@rxdi/ui-kit/button';
          
          import { Bootstrap} from 'http://localhost:8080/@rxdi/core';
          import { ReactiveUiModule } from 'http://localhost:8080/@rxdi/ui-kit';
          Bootstrap(ReactiveUiModule.forRoot()).subscribe()
        </script>
      </head>
      <body>
        <app-root></app-root>
      </body>
    </html>
  `,
});

litre's People

Contributors

stradivario avatar

Stargazers

zdrr avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.