メインコンテンツまでスキップ
バージョン: v2

Overview

Stencil: A Web Components Compiler​

Stencil is a compiler that generates Web Components (more specifically, Custom Elements). Stencil combines the best concepts of the most popular frameworks into a simple build-time tool.

Stencil uses TypeScript, JSX, and CSS to create standards-based Web Components that can be used to craft high quality component libraries, design systems, and applications.

Stencil generates standards-compliant Web Components that can work with popular frameworks right out of the box. In addition, Stencil can be used to generate framework native components that can be used just like any other components in your framework of choice. Stencil accomplishes this by wrapping your Web Components via Stencil's Output Target feature.

Compared to using Custom Elements directly, Stencil provides extra APIs that makes writing fast components simpler. APIs like Virtual DOM, JSX, and async rendering make fast, powerful components easy to create, while still maintaining 100% compatibility with Web Components. Stencil also enables a number of key capabilities on top of Web Components, in particular, prerendering, and objects-as-properties (instead of just strings).

The developer experience is also tuned, and comes with live reload and a small dev server baked into the compiler.

How can I use Stencil?​

Design Systems & Component Libraries​

Stencil's primary objective is providing amazing tools for design systems and component libraries. Components as a concept provide similar language for engineers and designers to have productive conversations about design implementation. Visit the Stencil for Design Systems page to learn more.

The History of Stencil​

Stencil was originally created by the Ionic Framework team in order to build faster, more capable components that worked across every major framework.

The emergence of Progressive Web Apps as a rapidly growing target for web developers demanded a different approach to web app development performance. With Ionic's classic use of traditional frameworks and bundling techniques, the team was struggling to meet latency and code size demands for Progressive Web Apps that ran equally well on fast and slow networks, across a diversity of platforms and devices.

Ionicは主にCordovaアプリを対象としていましたが、Web開発者にとって急速に成長するターゲットとしてのProgressive Web Appsの出現は、Webアプリ開発のパフォーマンスに対する異なるアプローチを要求していました。Ionicは従来のフレームワークとバンドルテクニックを古典的に使用していたため、チームはさまざまなプラットフォームとデバイスで高速ネットワークと低速ネットワークで同等に動作するProgressive Web Appsのレイテンシとコードサイズの要件を満たすのに苦労していました。

さらに、フレームワークを複数使用する場合、あるフレームワーク用に構築されたコンポーネントが別のフレームワークと連動しないという、Web開発の相互運用性の悪夢が生まれました。

Web Components by themselves, however, weren't enough. Building fast web apps required innovations that were previously locked up inside of traditional web frameworks. Stencil was built to pull these features out of traditional frameworks and bring them to the fast emerging Web Component standard. While Stencil is intended to be used primarily to build design systems and component libraries, these innovations allowed entire applications to be built using only Stencil.