DEV Community

mnmartinelli
mnmartinelli

Posted on

Open-WC Beginner Guide

Welcome to the world of Web Components!

Open-WC is a powerful tool to develop web-components fast. With some simple JavaScript here, and few installs there, you'll be an experienced developer in no time.

  • I highly recommend using Linux or WSL for web development, however this step is optional and all install links will be provided below. If you would look to install WSL with a customized terminal look and feel, follow my guide here.

Dependencies Required:

  • NodeJS NodeJS includes NPM and both can be installed with one command:
$ sudo apt-get install -y nodejs
Enter fullscreen mode Exit fullscreen mode

Optional Installs:

  • VS-Code
  • Recommended VSCode extensions: VSCode extensions

Open-WC Installation/Setup:

  1. Create a folder and enter into the directory:

    $ mkdir open-wc-demo
    $ cd open-wc-demo
    
  2. NPM install Open-WC

    $ npm init @open-wc
    
  3. Select "Scaffold a new project" using the enter key.

  4. Select "Web Component" using the enter key.

  5. Select All (Linting, Testing, & Demoing) by pressing "a" and then enter key.

  6. Please select "No" to not use typescript. We will be using Javascript.

  7. Then give your web-component a name, I will be calling mine "open-wc-test".
    Step 7 results

  8. Select Yes to write the file structure to the disk.

  9. Then, select "Yes, with npm" to install all dependencies.

  10. Lastly, to test if everything works run npm start

Your local web-sever should look like this

Developing with Open-WC

Hello World example provided by Lit Playground

Top comments (1)

Collapse
 
mrhili profile image
Mrhili Mohamed Amine

what is it exactly ?