npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

generator-web-component

v2.1.0

Published

Quickly scaffold web components with Yeoman

Downloads

23

Readme

Web Component Generator NPM version

Quickly scaffold lightweight web components with Yeoman, with just what's needed and none of the cruft. Built against the v1 Web Components spec.

Contents

Features

  • Generate standalone projects for distribution, or single file elements inside your own apps
  • Choose whether to bundle a framework like Polymer or build barebones
  • Optionally include Shadow DOM template boilerplate
  • Standalone projects come with a basic testing setup via Web Component Tester and a beautiful demo page served with browsersync

Check out the files in app/templates in this repo for a better idea of what you'll get.

Installation & usage

Install Yeoman and the component generator with NPM or Yarn

$ npm i -g yo generator-web-component

Then run it

$ yo web-component

Components for apps

To create a new web component for use inside an existing project, select 'Part of an app' when prompted. This will generate a single HTML file under the name of your element with the bare minimum of boilerplate.

Standalone components

To create a standalone element project in its own repo, select 'Standalone' when prompted. This will scaffold out a modern Web Component project, including a lightweight testing setup, a beautiful demo page, and standard config files.

It's recommended to build your element as an ES6 class directly in the [element-name].html file provided (or change it to a JavaScript file if you like), and allow the consumers of your element to do their own transpilation to ES5 if they want to support legacy browsers.

The following NPM scripts will be configured for you:

Script | Description ---------- | ----------- test | Runs your WCT test suite in local browsers posttest | Runs Eslint after tests (eg: for Travis) demo | Runs a demo server (with Browsersync) which reloads whenever you make changes in your component

Run the scripts with NPM

$ npm run demo

The demo server is available on localhost:3000


Todo

There are a few more options that should be added to this generator, if you'd like to contribute a PR adding any of these features I'll gladly merge it!

  • Add optional (and configurable) buildstep (issue)
    • Rollup module bundling
    • PostCSS + Autoprefixer
  • Add SkateJS framework option (issue)
  • Bundle Yeoman and Browsersync into web-component-cli? In similar vein to polymer-cli but not tied to a framework

MIT © Sean King