What is in a folder?
An LWC is a set of files:
- HTML file (optional)
- Javascript file (must-have)
- XML file (must-have)
- CSS file (optional)
- SVG file (optional)
- Tests Folder (optional)
The folder and its files must follow these rules:
- Must begin with a lowercase letter
- Must contain only alphanumeric or underscore characters even though not recommended
- Must be unique in the namespace
- Can’t include whitespace, a hyphen or two consecutive underscores
- Can’t end with an underscore
HTML file
HTML file is only required for user interface. So-called Service Components that don’t need UI, don’t need an HTML file.
- Root tag must be
<template>
Minimal HTML file: