logo

GREMLIN.JS dead simple web components

GREMLIN.JS is a dependency-free library to build web components. Web components for boringly normal websites, all your websites. Webapps are not for everyone and everything, but modular and well organized code is.

How does it feel?

All examples in this documentation use the ES2015/ES6 syntax. Use a compiler like Babel to compile them into ES5 compatible Javascript.


Add a custom dom element

<hello-world>
  <p data-content></p>
</hello-world>


Add a spec

gremlins.create('hello-world', {
  created: function(){
    this.el.querySelector('[data-content]').textContent = 'Hello World!';
  }
});


done

Installation

NPM

$ npm install --save gremlins

Classic

download the latest release at github and include the minified file found in dist

 <script src="gremlins.js" />

Usage

Browserify, Webpack

import gremlins from 'gremlins';

Global

const gremlins = window.gremlins;

the global namespace isn't available in a common-js/es2015-module environment