Create web component in the CLI
Web components allow you to create reusable custom HTML elements by combining HTML, CSS, and JS code. A web component consists of five different files:
- A HTML file
- A CSS file
- A JS file
- A
config.jsfile - A
boot.jsfile
When creating a project, a component named
appis created by default. In your project's folder structure, you might have noticed a folder namedapp, with the filesapp-component.html,app-component.css,app-component.js,config.js, andboot.js.
Create a component#
Running this command will create a folder named <COMPONENT_NAME> containing the appropriate files in the src/ folder.
Example 1#
Learn how to use the web component.
Overwrite a component#
Running this command will replace an existing component with a brand new one. All changes made to the five files present inside the <COMPONENT_NAME> folder will be reset.