SkateJS is a web component library designed to give you an augmentation of the web component specs focusing on a functional rendering pipeline, clean property / attribute semantics and a small footprint.
JavaScript TypeScript
Latest commit 64e0af1 Mar 24, 2017 @treshugart treshugart committed on GitHub Merge pull request #1107 from skatejs/greenkeeper-babel-eslint-7.2.1
babel-eslint@7.2.1 breaks build ⚠️
Permalink
Failed to load latest commit information.
definitions/w3c-customelements refactor: Indentation Jan 11, 2017
docs Docs refactoring + code reusability recipes (#1081) Feb 14, 2017
src fix(ts-typings): make LC hooks on Copoment required - cause they are … Feb 19, 2017
test style: apply ts-formatter Feb 19, 2017
.babelrc refactor: Refactor rest of build. Moved deprecated into component bec… Jan 13, 2017
.editorconfig chore: add EditorConfig Aug 25, 2016
.gitignore fix(ts-typings): make prop api generic and 100% type safe (#1048) Jan 27, 2017
.travis.yml chore(travis): Don't switch based on travis env vars. Assume anything… Jan 27, 2017
CHANGELOG.md docs(Readme): chunk Readme into gitbook (#951) Dec 18, 2016
CONTRIBUTING.md chore: Update all other instances referring to skatejs-build Jan 13, 2017
LICENSE Move license to separate file. Jul 16, 2015
README.md docs(index): Update transpile section again. Feb 2, 2017
SUMMARY.md Docs refactoring + code reusability recipes (#1081) Feb 14, 2017
book.json docs(api): tweak api docs to separate chapters (#1008) Jan 11, 2017
karma.browsers.js refactor: Refactor rest of build. Moved deprecated into component bec… Jan 13, 2017
karma.conf.js refactor: Refactor rest of build. Moved deprecated into component bec… Jan 13, 2017
package.json chore(package): update babel-eslint to version 7.2.1 Mar 23, 2017
tsconfig.json fix(ts-typings): make prop api generic and 100% type safe (#1048) Jan 27, 2017
webpack-blocks.js fix(global): Fix incremental-dom global name. Jan 17, 2017
webpack.config.bundle.js chore: Separate webpack builds into ones that generate bundle with de… Jan 11, 2017
webpack.config.js chore: Separate webpack builds into ones that generate bundle with de… Jan 11, 2017
yarn.lock test: Fix tests and simplify incluson of polyfills. Jan 29, 2017

README.md

Skate

Downloads per month NPM version Build Status Join the chat at https://gitter.im/skatejs/skatejs Commitizen friendly Semantic Release OpenCollective OpenCollective Follow @skate_js on Twitter

Sauce Test Status

Skate is a library built on top of the W3C web component specs that enables you to write functional and performant web components with a very small footprint.

  • Functional rendering pipeline backed by Google's Incremental DOM.
  • Inherently cross-framework compatible. For example, it works seamlessly with - and complements - React and other frameworks.
  • It's very fast.
  • It works with multiple versions of itself on the page.

HTML

<x-hello name="Bob"></x-hello>

JavaScript

customElements.define('x-hello', class extends skate.Component {
  static get props () {
    return {
      name: { attribute: true }
    };
  }
  renderCallback () {
    return skate.h('div', `Hello, ${this.name}`);
  }
});

Result

<x-hello name="Bob">Hello, Bob!</x-hello>

Whenever you change the name property - or attribute - the component will re-render, only changing the part of the DOM that requires updating.

Documentation

Installing

There's a couple ways to consume Skate.

NPM

npm install skatejs

Skate exports a UMD definition so you can:

import * as skate from 'skatejs';
const skate = require('skatejs');
require(['skatejs'], function (skate) {});

There's three files in dist/. Each has a UMD definition and a corresponding sourcemap file:

  1. index.js - This is the main entry point in the package.json without dependencies.
  2. index-with-deps.js - Unminified with dependencies.
  3. index-with-deps.min.js - Minified with dependencies.

Script Tag

<script src="https://unpkg.com/skatejs/dist/index-with-deps.min.js"></script>

Since Skate exports a UMD definition, you can then access it via the global:

const { skate } = window;

Dependencies

Skate doesn't require you provide any external dependencies, but recommends you provide some web component polyfills depending on what browsers you require support for. Skate requires both Custom Elements and Shadow DOM v1.

To get up and running quickly with our recommended configuration, we've created a single package called skatejs-web-components where all you have to do is load it before your definitions.

npm install skatejs skatejs-web-components

And then you can import it:

import 'skatejs-web-components';
import { define, vdom } from 'skatejs';

Or you can use script tags:

<script src="https://unpkg.com/skatejs-web-components/dist/index.min.js"></script>
<script src="https://unpkg.com/skatejs/dist/index-with-deps.min.js"></script>

If you want finer grained control about which polyfills you use, you'll have to BYO Custom Element and Shadow DOM polyfills.

Transpilation and native custom element gotchas

If you’re using Babel or some other tool to transpile your ES2015 code to ES5, simply import skatejs and skatejs-web-components (or selectively include the polyfills) as needed and ignore the following.

Native custom element support requires that you load a shim if you're not delivering native ES2015 classes to the browser. If you're transpiling to ES5, you must - at the very least - load the native shim:

When you load Skate by module name (import { ... } from 'skatejs'; or require('skatejs');), you'll be getting the transpiled source. Thus even if you author your components in ES2015, you'll still be getting ES5 base-classes and the native custom elements implementation will complain. If you want to deliever native classes you have to point to the non-transpiled Skate source: import { ... } from 'skatejs/src';. Currently this is not supported by our API versioning but we have an issue to work around this.

More information can be found in the webcomponents/custom-elements repo.

Browser Support

Skate supports all evergreens and IE11. We recommend using the following polyfills:

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]