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.js
file - A
boot.js
file
When creating a project, a component named
app
is 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 componentRunning this command will create a folder named <COMPONENT_NAME>
containing the appropriate files in the src/
folder.
#
Example 1Learn how to use the web component.
#
Overwrite a componentRunning 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.