Giter Site home page Giter Site logo

jdgomezb / stencil Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ionic-team/stencil

0.0 0.0 0.0 63.66 MB

A toolchain for building scalable, enterprise-ready component systems on top of TypeScript and Web Component standards. Stencil components can be distributed natively to React, Angular, Vue, and traditional web developers from a single, framework-agnostic codebase.

Home Page: https://stenciljs.com

License: Other

Shell 0.01% JavaScript 1.07% TypeScript 97.03% CSS 0.45% HTML 1.39% Less 0.01% SCSS 0.03% Stylus 0.01%

stencil's Introduction

stencil-logo

Stencil

A compiler for generating Web Components

StencilJS is released under the MIT license. StencilJS is released under the MIT license. PRs welcome! Follow @stenciljs

Stencil is a simple compiler for generating Web Components and static site generated progressive web apps (PWA). Stencil was built by the Ionic team for its next generation of performant mobile and desktop Web Components.

Stencil combines the best concepts of the most popular frontend frameworks into a compile-time rather than run-time tool. It combines TypeScript, JSX, an asynchronous rendering pipeline to ensure smooth running animations and lazy-loading, to generate 100% standards-based Web Components that run on both modern browsers and legacy browsers.

Stencil components are just Web Components, so they work in any major framework or with no framework at all. In many cases, Stencil can be used as a drop in replacement for traditional frontend frameworks given the capabilities now available in the browser, though using it as such is certainly not required.

Stencil also enables a number of key capabilities on top of Web Components, in particular Server Side Rendering (SSR) without the need to run a headless browser, pre-rendering, and objects-as-properties (instead of just strings).

Getting Started

To create a new project using an interactive cli, run:

npm init stencil

To start developing your new Stencil project, run:

npm start

Creating components

Stencil components are TypeScript classes with decorator metadata. The decorators themselves are purely build-time annotations so the compiler can read metadata about each component, and removed entirely for smaller efficient components.

Create new components by creating files with a .tsx extension, such as my-component.tsx, and place them in src/components.

import { Component, Prop, h } from '@stencil/core';

@Component({
  tag: 'my-component',
  styleUrl: 'my-component.css'
})
export class MyComponent {

  @Prop() first: string;
  @Prop() last: string;

  render() {
    return (
      <div>
        Hello, my name is {this.first} {this.last}
      </div>
    );
  }
}

To use this component, just use it like any other HTML element:

<my-component first="Stencil" last="JS"></my-component>

Thanks

Stencil's internal testing suite is supported by the BrowserStack Open-Source Program

stencil's People

Contributors

adamdbradley avatar manucorporat avatar jthoms1 avatar rwaskiewicz avatar jgw96 avatar brandyscarney avatar alicewriteswrongs avatar mlynch avatar simonhaenisch avatar kensodemann avatar splitinfinities avatar mattdsteele avatar dependabot[bot] avatar ltm avatar danbucholtz avatar tricki avatar bodinaren avatar tja4472 avatar imhoffd avatar claviska avatar fionawhim avatar arjunyel avatar mhartington avatar mexx avatar willmartian avatar petermikitsh avatar wickynilliams avatar juanmiguelbesada avatar jeanbenitez avatar george-payne 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.