Hello! Today will be a blog post on how to instal and set up the appropriate tools to be able to use web components on macOS.
NodeJS
The first step will be to install nodeJS LTS for more stability at the link here: https://nodejs.org/en/. All this download takes is a simple file and you are good to go.
Homebrew
installing home-brew will make the rest of this process and future downloads much faster due to avoiding sudo access that could possibly come with making installations through npm. First, enter this into your terminal window: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" Follow the instructions on the terminal window and wait till installation is done. Note This installation will require sudo access so make sure you know your password.
Yarn
Now installing yarn with node is simple, just type: brew install yarn, into your terminal window.
Git
Also now is a good time to install Git while everything else is installing. Go to your terminal window and type: brew install git.
Creating a Directory
Create a directory however you want on your machine, either through the command Lind or just the desktop. I made a new folder through the desktop by right clicking, then hitting new folder and naming it git. From there I created a new folder inside of it named edtechjoker, but you can name it whatever you want.
Web Component
Now it is time to create your first web component.
- go to terminal window and type: npm init @open-wc
- Hit enter to select scaffold a new project
- Hit enter to select Web Component
- Hit A to select all then hit enter
- Hit enter to select no to typescript
- Type in "hello-world" no capital or spaces as the name of the web component.
- Hit enter to select yes to writing to disk
- Hit enter to install dependencies with yarn
- After it is done building the web component, type in "cd hello-world"
- Type in "npm run start"
Congratulations! you have just built your first web component!
Top comments (0)