Stencil

在TypeScript和Web组件标准之上构建可扩展、企业就绪的组件系统的工具链。Stencil组件可以从一个与框架无关的代码库中原生发布给React、Angular、Vue和传统网络开发人员。「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.」

Getting Started

Start a new project by following our quick Getting Started guide.
We would love to hear from you!
If you have any feedback or run into issues using Stencil, please file an issue on this repository.

Examples

A Stencil component looks a lot like a class-based React component, with the addition of TypeScript decorators:

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

@Component({
  tag: 'my-component',            // the name of the component's custom HTML tag
  styleUrl: 'my-component.css',   // css styles to apply to the component
  shadow: true,                   // this component uses the ShadowDOM
})
export class MyComponent {
  // The component accepts two arguments:
  @Prop() first: string;
  @Prop() last: string;

   //The following HTML is rendered when our component is used
  render() {
    return (
      <div>
        Hello, my name is {this.first} {this.last}
      </div>
    );
  }
}

The component above can be used like any other HTML element:

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

Since Stencil generates web components, 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 framework, though using it as such is certainly not required.

Contributing

Thanks for your interest in contributing!
Please take a moment to read up on our guidelines for contributing.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.

Thanks

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

主要指標

概覽
名稱與所有者stenciljs/core
主編程語言TypeScript
編程語言JavaScript (語言數: 6)
平台Cross-platform, Web browsers
許可證Other
所有者活动
創建於2017-02-15 18:57:07
推送於2025-07-21 22:55:18
最后一次提交
發布數722
最新版本名稱v4.36.1 (發布於 )
第一版名稱v0.0.1 (發布於 2017-07-06 15:14:27)
用户参与
星數12.8k
關注者數172
派生數813
提交數8.1k
已啟用問題?
問題數3054
打開的問題數270
拉請求數2713
打開的拉請求數7
關閉的拉請求數499
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?