Socket
Socket
Sign inDemoInstall

@stencil/core

Package Overview
Dependencies
0
Maintainers
11
Versions
1164
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @stencil/core

A Compiler for Web Components and Progressive Web Apps


Version published
Weekly downloads
699K
increased by3.48%
Maintainers
11
Install size
15.5 MB
Created
Weekly downloads
 

Changelog

Source

🚂 2.17.0 (2022-06-21)

Features

  • compiler: export all built components from index.js w/ dist-custom-elements (ff0e8cc), closes #3368
  • compiler: update generation of type declaration file w/ dist-custom-elements (9d3bf15), closes #3368
  • mock-doc: add matrix and tspan props for svgelement (#3408) (d3b93c1)
  • telemetry: add stencil config to telemetry object (#3401) (9fe3f15)

Readme

Source

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

Quick Start · Documentation · Contribute · Blog
Community: Slack · Forums · Twitter

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

Keywords

FAQs

Last updated on 21 Jun 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc